SocketCluster / SocketCluster/socketcluster
When trying to require scworker.js or scbroker.js directly, throw a better error
Open
@jondubois is already working on this.
Since Apr 7, 2018.
- Dominant language
- JavaScript
- Stars
- 6.2k
- Forks
- 318
- PR merge metrics
- No merged PRs in 30d
Description
Currently, if someone tries to require scworker.js directly into another script without first setting up the correct environment variables, it will throw this error:
SyntaxError: Unexpected token u in JSON at position 0
Generally, scworker.js should not be included directly into a Node.js script; it should be loaded by SC itself but it should at least be supported for unit testing purposes.
The current error should be improved to make this more clear.
Should be done for both scworker.js and scbroker.js.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.