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

Add OperationError error type #296

Merged
merged 1 commit into from
Apr 30, 2018
Merged

Add OperationError error type #296

merged 1 commit into from
Apr 30, 2018

Conversation

d98762625
Copy link
Member

Add OperationError Error type and use for errors to be printed to the output panel

Why

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 new OperationError 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

  • I have left the RawInflate operation error uncaught, as it was never caught and printed originally. This was the only other currently-converted class that had throw in it.
  • The new babel-plugin-transform-builtin-extend library is necessary for babel to recognise extends from native JS types. Otherwise instanceof OperationError doesn't work.

@d98762625 d98762625 requested a review from n1474335 April 27, 2018 10:13
@d98762625
Copy link
Member Author

@n1474335 I would appreciate your feedback, especially around making sure I haven't missed anything in the Recipe flow

Copy link
Member

@n1474335 n1474335 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, I'll merge it now. Remember to add the author, copyright and license in the top level comment for new files.

I like how this works well with the progress indicator so that operations that error get highlighted in red.

@n1474335 n1474335 merged commit cc20ad9 into gchq:esm Apr 30, 2018
@n1474335 n1474335 added this to the v8.0.0 milestone May 15, 2018
@d98762625 d98762625 deleted the op-errors branch May 29, 2018 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants