Skip to content

Two minor fixes to error handling #14

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mindplay-dk
Copy link

  1. You can't actually test for existence of console in global scope by just doing if (console) - this would error. I've corrected it to test with typeof console !== "undefined" which won't error in the absence of console.

  2. Accessing global console and writing to the log is an uncontrollable side-effect that creates problems for me, as I'm actually using the console to output JSON data. To avoid a breaking change, I've kept this behavior, but made it optional: you can now supply an optional onError callback instead, overriding the backwards-compatible default behavior of writing to the console.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1. You can't actually test for existence of `console` in global scope by just doing `if (console)` - this would error. I've corrected it to test with `typeof console !== "undefined"` which won't error in the absence of `console`.

2. Accessing global `console` and writing to the log is an uncontrollable side-effect that creates problems for me, as I'm actually using the console to output JSON data. To avoid a breaking change, I've kept this behavior, but made it optional: you can now supply an optional `onError` callback instead, overriding the backwards-compatible default behavior of writing to the console.
@mindplay-dk
Copy link
Author

@albell is this project maintained?

Looks like no releases since 2016 - but also no open issues, so that could just mean it's done and the spec hasn't changed.

We can't have side-effects in our project - so if this project is unmaintained (or for some reason you don't want to merge this change) we may need to fork the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants