Fix reconstruct: throw ArgumentError on invalid input type#239
Fix reconstruct: throw ArgumentError on invalid input type#239anurag-mds wants to merge 3 commits intoJuliaStats:masterfrom
Conversation
|
Maintainers, |
|
Hi @andreasnoack , just following up on this PR. It has been a couple of months, and I wanted to see if there is anything else needed from my side to move this forward. All CI checks are passing and it should be a clean merge. Thanks! |
|
Regarding the fallback method in src/types.jl: That makes sense. I was aiming for a more descriptive message for beginners, but I agree that relying on the standard MethodError is cleaner and more idiomatic for the package. I’ll remove that fallback method |
Summary
This PR addresses the issue #238 by improving the error handling in the fallback reconstruct method for dimensionality reduction models. Now, whenever it is called with an input which is not an AbstractVecOrMat of real numbers, an ArgumentError is thrown with a clear message which helps user to know the invalid input type and the expected input type.This closes the issue #238
Approach
Following is the way of my approach which ensures users receive clear, actionable feedback and aligns with Julia's best practices for error handling.Confirmed that the fallback reconstruct method previously gave a misleading error when it was called with an invalid input type.
Replace the generic error with a more meaningful, specific and reasonable error which clearly states the received and expected types.
Updated the necessary documentation and docstring for it.
Added and verified tests to ensure the new error is raised for invalid input types.
Tests
All tests pass.Notes
I have attached images showing that the tests are passing
Images:
Feedbacks are welcome.