Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for missing required parameters #412

Open
imagejan opened this issue Dec 3, 2020 · 1 comment · May be fixed by #414
Open

Improve error message for missing required parameters #412

imagejan opened this issue Dec 3, 2020 · 1 comment · May be fixed by #414

Comments

@imagejan
Copy link
Member

imagejan commented Dec 3, 2020

See #380 (comment).

Maybe we can add some API (to ObjectService? somewhere else?) to keep track of human-friendly types, such as:

String friendlyType = objectService.getHumanFriendlyName(Type type); // e.g. RandomAccessibleInterval => "an image"

(falling back to "an object"),
and then something like:

"This operation requires " + name + " of type " + type + "."

... to generate an error message such as:

This operation requires an image of type RandomAccessibleInterval.

@imagejan
Copy link
Member Author

While looking into this, I was surprised to find that there is a different (slightly better?) message already, located in CheckInputsPreprocessor:

if (input.isRequired() && input.getValue(module) == null) {
cancel("'" + input.getName() + "' is required but unset.");
}

... but it never/rarely gets executed because AbstractInputHarvester is taking it:

if (item.isRequired()) {
throw new ModuleException("A " + type.getSimpleName() +
" is required but none exist.");
}

@imagejan imagejan linked a pull request Dec 19, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant