eclipse-paho / eclipse-paho/paho.mqtt.javascript

throw exceptions as last resort

Open
#144 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
466
PR merge metrics
No merged PRs in 30d

Description

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 `TypeError`s or exceptions if that must happen. Document the API (audit the docstrings).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.