Skip to content

Conversation

@OscarVanL
Copy link

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 the details 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:

{
        "errorType": "error-input-is-not-a-valid-field",
	"details": {
		"method": "insertOrUpdateUser",
		"input": "sdfsdf ;;; ; ; -- ; ; fsdf",
		"field": "Username"
	}
}
  • 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.

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Apr 5, 2023
@github-actions
Copy link

This PR was closed because it has been stalled for 10 days with no activity.

@github-actions github-actions bot closed this Apr 15, 2023
@badkaktus badkaktus reopened this Apr 19, 2023
@github-actions github-actions bot removed the Stale label Apr 20, 2023
@badkaktus badkaktus self-requested a review August 28, 2023 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants