Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes my issue: #13
Embeds an ErrStatus struct, which contains all of the Rocket.Chat error response fields that can be populated under different scenarios.
The error handling approach is inspired by how Rocket.Chat's Go SDK handles REST errors, but extended to handle a couple of extra error response fields I have come across and add informative error messages.
Adds an option
WithDebug
, which will also include thedetails
field which is sometimes present in error responses. I didn't include this by default because you can get errors that could expose data in logs you didn't want to, like this for validation error's inputs:I also fixed up some function comments to be properly formatted Godoc docstrings.
This could be considered a breaking change if some consumers of this package want request errors to fail without returning an
err
, but as this is a v0 package we're fine to make breaking changes.