RocketChat / RocketChat/Rocket.Chat.js.SDK
SDK api post returns undefined when error
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 146
- Forks
- 99
- Avg merge
- 7h 59m
- Merged PRs (30d)
- 17
Description
When using SDKs API, I make a post request. Tried async / await as well but no way can I get a handle error returned by request.
api
.post("users.create", {
name: data.name,
email: data.email,
password: data.password,
username: data.username,
roles: ["anonymous"]
})
.then(res => console.log(res))
.catch(error => console.error(error));
I get the following error on logs generated by API but no way can I get a handle on error thrown, all I get is undefined.
[API] POST error (users.create): {
success: false,
error: 'ajskajs is already in use :( [error-field-unavailable]',
errorType: 'error-field-unavailable'
}
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.
Research direction
Start by reproducing the SDK API POST for users.create with the shown promise and inspect how the request error is propagated to catch. Trace the POST error handling until the logged structured error is returned to the caller; done means the catch callback receives the error instead of undefined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100