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

Null image shows wrong error message #59

Closed
rimadoma opened this issue Apr 12, 2017 · 6 comments
Closed

Null image shows wrong error message #59

rimadoma opened this issue Apr 12, 2017 · 6 comments
Labels

Comments

@rimadoma
Copy link
Contributor

When you try to run the plugins with no images open, the user sees the wrong error message: "A ImgPlus is required but none exist". They should see a clearer "No image open" message.

The plugins check for null in the "validater" (sic) method of their image parameters. At least with the legacy UI execution of a plugin doesn't get this far before it's stopped with the wrong message. However, the tests for proper cancel messages still pass. Thus the issue probably originates from some kind of automatic conversion going on with the legacy UI. This can be fixed by checking for null in the initializer of a @parameter. The validater should then check for other properties of the image

@rimadoma rimadoma added the bug label Apr 12, 2017
@imagejan
Copy link
Contributor

Maybe this is something worth to improve on the SciJava side? The error message is generated during input harvesting here:
https://github.com/scijava/scijava-common/blob/608831075023f9ddf053691a82c2be24458f337c/src/main/java/org/scijava/widget/AbstractInputHarvester.java#L122-L123

@rimadoma
Copy link
Contributor Author

Could it be something as simple as

if (ImgPlus.class.isAssignableFrom(type) || Img.class.isAssignableFrom(type)) {
    throw new ModuleException("No image open");
}

?

@imagejan
Copy link
Contributor

The message "No image open" doesn't make much sense if you run the command headless via scripting or from within KNIME.

@rimadoma
Copy link
Contributor Author

Would "The command requires an image" make more sense?

@rimadoma
Copy link
Contributor Author

PR created

@rimadoma
Copy link
Contributor Author

PR rejected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants