Skip to content

Replace ValidityProblem usage with InvalidOpExceptions#88

Merged
gselzer merged 1 commit into
mainfrom
scijava/scijava-ops-engine/replace-validity-problem
Oct 11, 2023
Merged

Replace ValidityProblem usage with InvalidOpExceptions#88
gselzer merged 1 commit into
mainfrom
scijava/scijava-ops-engine/replace-validity-problem

Conversation

@gselzer

@gselzer gselzer commented Aug 22, 2023

Copy link
Copy Markdown
Member

This PR makes Ops throw InvalidOpExceptions instead of ValidityExceptions - this creates a simpler structure for conveying issues with Op configuration/declaration to Op developers. It also provides a suite of tests to ensure invalid Ops are being

TODO: @hinerm - you said here that you do not want string comparison - can you elaborate on why? Would you prefer that we subclass InvalidOpException for each of the reasons of failure? There would be a lot of subclasses with pretty detailed names, if you'd prefer that...

@gselzer gselzer added the enhancement New feature or request label Aug 22, 2023
@gselzer gselzer requested a review from hinerm August 22, 2023 18:06
@gselzer gselzer self-assigned this Aug 22, 2023
@gselzer gselzer force-pushed the scijava/scijava-ops-engine/replace-validity-problem branch from 4506778 to 77d0951 Compare August 22, 2023 18:14
@gselzer

gselzer commented Aug 22, 2023

Copy link
Copy Markdown
Member Author

This will close scijava/scijava#105

@gselzer gselzer linked an issue Aug 22, 2023 that may be closed by this pull request
3 tasks
@hinerm

hinerm commented Aug 24, 2023

Copy link
Copy Markdown
Member

you said scijava/scijava#105 (comment) that you do not want string comparison - can you elaborate on why? Would you prefer that we subclass InvalidOpException for each of the reasons of failure?

@gselzer so the concern I had was using raw string values as a substitute for testing for the type of failure. If the error's message changes for any reason the test will fail. What you're testing is that the error message is consistent, but what you actually want to test is that the type of error is consistent.

Subclassing and checking the subclass in the test would probably be the most Java-correct thing to do. Using constants, like in BaseOpHints, instead of raw strings in the test expected values would be an acceptable improvement.

@gselzer gselzer force-pushed the scijava/scijava-ops-engine/replace-validity-problem branch from a20ac75 to 451fa93 Compare August 29, 2023 19:03
@gselzer

gselzer commented Aug 29, 2023

Copy link
Copy Markdown
Member Author

@hinerm I made a bunch of subclasses, let me know what you think of this.

@gselzer gselzer force-pushed the scijava/scijava-ops-engine/replace-validity-problem branch 12 times, most recently from 748da4f to a69b7b4 Compare October 11, 2023 21:31
@gselzer gselzer force-pushed the scijava/scijava-ops-engine/replace-validity-problem branch from a69b7b4 to 44348e9 Compare October 11, 2023 21:41
@gselzer gselzer merged commit 8cd678c into main Oct 11, 2023
@gselzer gselzer deleted the scijava/scijava-ops-engine/replace-validity-problem branch October 11, 2023 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

Make use of ValidityProblems during Op matching

2 participants