FNNDSC / FNNDSC/ami

The library swallows parsing errors

Open
#387 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
745
Forks
212
PR merge metrics
No merged PRs in 30d

Description

### Description
When loading a mhd/raw image (probably same with some nifti images) where some metadata is missing in the mhd file, the library just prints the error to the console and swallows it. This is a big problem for applications using the library. Asking the users to check the console is not user friendly. I would like that the errors thrown are bubbled up to the application, so that it can react, for example by:
- removing the 'Loading …' message
- showing the error to the user in an application specific way.

### Suggested correction
In all 4 places where errors are catched and messages are sent to the console, rethrow the error. The places in the code are were the following appears:
- window.console.log('oops... something went wrong...');
- window.console.log('ooops... :(');
Adding a 'throw error;' is enough in these 4 cases.

### How to trigger the error
Load a mhd/raw image where optionnal fields like TransformMatrix or AnatomicalOrientation is missing.

### Browsers Affected
All

### Versions
- AMI: v0.32.0
- THREEJS: r105

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.