Provide more helpful Op matching exceptions#118
Merged
Conversation
68bb3be to
71fb963
Compare
71fb963 to
4ce01bf
Compare
The actual response leans on the OpEnvironment.help() implementation, so we may want to edit that as needed...
4ce01bf to
62b2837
Compare
hinerm
reviewed
Jan 26, 2024
| var msg = "No match found!"; | ||
| try { | ||
| // TODO: Remove try/catch. | ||
| msg += " Perhaps you meant: \n" + env.help(request); |
Member
There was a problem hiding this comment.
conceptually this seems useful. We'll have to see if it is in practice but I don't see any reason not to do it now.
hinerm
reviewed
Jan 26, 2024
| catch (OpMatchingException e) { | ||
| Assertions.assertTrue(e.getMessage().startsWith( | ||
| "No MatchingRoutine was able to produce a match!")); | ||
| "No match found!")); |
hinerm
approved these changes
Jan 26, 2024
Since this should be fixed, we want to know of any further StackOverflows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR leans on the new
OpEnvironment.help()API to enable more helpfulOpMatchingExceptions.This means that if the following Op call does not match:
You will now get an error like:
Of course, this output will change with #113, and we might want to make further alterations to the help functionality.
EDIT: Unfortunately, in SciJava Ops Image this change is being bitten by scijava/scijava#176, which means that the build increases by 2 minutes (because of one test file!). For now I'm going to try/catch this issue.