dicomParser
dicomParser copied to clipboard
Don't throw object, throw Error
catch(e) {
var ex = {
exception: e,
dataSet: dataSet
};
throw ex;
}
which leave this in the console:
dicomParser.js:157 Uncaught [object Object]
see: http://eslint.org/docs/rules/no-throw-literal
I agree exceptions should use Error but am concerned that changing this is not backwards compatible. Perhaps we do this in 2.0 or add an options flag to optionally enable this behavior?
I started using promises to wrap this and dump out the promise chain error, it actually returns the data if that helps at all.
I haven't forgotten about this but it is a breaking change to the API so will have to wait until the 2.0 release
+1 on this, was rather surprised to get an object containing the full DataSet as UInt8Array logged in an error handler. Happy to help if version 2.0 is planned.
Forward backward compatibility pre-2.0, you could introduce some global setting that controls how exceptions are raised and potentially prints a deprecation warning when the default (old style) is in use.