eclipse-paho / eclipse-paho/paho.mqtt.javascript
throw exceptions as last resort
Open
- 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
Assessment
This issue has not been assessed yet.