Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
OperationError
Error type and use for errors to be printed to the output panelWhy
In issue #287 I mentioned error handling behaviour and the need for Operations to throw errors. This is so in the api we can catch them and return them in the expected format (in a promise
.catch
, for example).This PR lays the ground work for that by introducing an
OperationError
class, which is thrown whenever an operation caught an error and printed the message as the output. The Recipe now handles the error catching and printing, but only if it is of this newOperationError
class.There was enough work here for it to be a standalone PR. Plus, I think it's best to introduce this error class ASAP so we can use it in the other operations as we move them over to module format. I have converted all current non-legacy operations to use this new method, but I assume others will need to use it too.
Expected behaviour change
None
Notes
RawInflate
operation error uncaught, as it was never caught and printed originally. This was the only other currently-converted class that hadthrow
in it.babel-plugin-transform-builtin-extend
library is necessary for babel to recogniseextends
from native JS types. Otherwiseinstanceof OperationError
doesn't work.