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.
Summary
Make ngx-turnstile emit error code when the widget encounters an error.
Motivation
Currently, ngx-turnstile doesn't pass any error-callback configuration to the Turnstile widget, so by default "Turnstile will throw a JavaScript exception upon error". This may cause quite a lot of noise in error tracking systems like Rollbar.
This PR adds an error-callback that emits the error code as a component output.
ngx-turnstile users can subscribe to this error code and handle it according to their needs, which helps to address issue #26.
Caveats
Ideally, the ngx-turnstile component should accept a callback
Function
as input:However, I'm not sure how to implement that, so I've replicated the EventEmitter approach from the
resolved
output. Now, in order to intercept the error code, ngx-turnstile will always pass 'error-callback' to the Turnstile widget.Warning: breaking changes
The caveats above would mean that ngx-turnstile users will no longer see exceptions being thrown. Instead, they'll see the error code logged as a console warning.
(It would be great if someone could help with avoiding this breaking change!)