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

throw exceptions as last resort #144

Open
boneskull opened this Issue Feb 21, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@boneskull

boneskull commented Feb 21, 2018

In many places throughout the client, we're throwing exceptions where exceptions don't need to be thrown. It's more user-friendly to simply choose a default, coerce a type, warn, or just ignore some behaviors.

For example:

  • If the client is already connected, there's no need to throw an exception if connect() is called again. A warning would suffice, if anything.
  • Don't validate types up-front; choose sane defaults, let JS coerce types if possible, and throw its own TypeErrors or exceptions if that must happen. Document the API (audit the docstrings).

@boneskull boneskull changed the title from throw exception as last resort to throw exceptions as last resort Feb 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment