ome / omero-iviewer

An OMERO.web app allowing to view images
https://www.openmicroscopy.org/omero/iviewer/
Other
19 stars 30 forks source link

Image loading error handling #474

Closed will-moore closed 6 months ago

will-moore commented 7 months ago

Fixes #473

This improves the error handling for loading image data when you first open iviewer.

Previously we only handled 404 Image not found, but if any JSON data was returned, even with exceptions, then these were ignored and the viewer would silently fail.

I have handled the possible Errors etc that are reported by the python error handling at various stages, such as ConcurrencyException and other catch-all exceptions:

Screenshot 2024-04-24 at 16 51 31

Screenshot 2024-04-24 at 16 52 33

To test, you need to generate or find broken images (or missing pyramids etc).

Most of the testing I've done has been by artificially adding errors at particular points in the python code.

pwalczysko commented 7 months ago

I have removed renamed a file in ManagedRepo and then opened the image in iviewer.

I get

Screenshot 2024-04-26 at 15 31 02

pwalczysko commented 7 months ago

With an image without pyramids I get

Screenshot 2024-04-26 at 16 00 22

Interestingly, on Preview, there is no warning either (I realize this is for another PR) but it would be useful too, cf https://www.openmicroscopy.org/qa2/qa/feedback/41603/

pwalczysko commented 7 months ago

How to elicit no channel data loaded error ?

will-moore commented 7 months ago

The no channel data is designed to handle the response returned from https://github.com/ome/omero-web/blob/e1b1355ebd4f9de8b855dd2c55f59d86c061a81b/omeroweb/webgateway/marshal.py#L257

The code comment says Will happen if an image has bad or missing pixel data but I don't know if that's still true or how to trigger it. I can create that exception by adding test = "fail" + 1 into the try/except block above:

Screenshot 2024-04-26 at 17 06 27

will-moore commented 7 months ago

With that last commit, we try to load the omero.server.nodedescriptors config from the server. If we can load it and it is set and it doesn't contain "PixelData", then we know that pyramid creation is disabled and the error with ConcurrencyException should look like this (EDIT: updated to include the commit below):

Screenshot 2024-05-02 at 09 42 46

Otherwise it's probable that we can generate pyramids (unless this is disabled on an older server that doesn't allow us to query it), so we show this:

Screenshot 2024-04-29 at 16 12 40

pwalczysko commented 7 months ago

Screenshot 2024-05-02 at 13 22 41 Screenshot 2024-05-02 at 13 02 10

With a "large" image without pyramids, I am having the two messages if pyramid gen is a) disabled (first screenshot) or b) enabled (second screenshot). Lgtm

pwalczysko commented 7 months ago

I understand that https://github.com/ome/omero-iviewer/pull/474#issuecomment-2079684660 is very hard to elicit and was never encountered, actually the error is being caught for completeness sake.

Lgtm in total.