Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create uniform error structure #115

Merged

Conversation

james-a-morris
Copy link
Contributor

No description provided.

Copy link

linear bot commented Nov 25, 2024

@james-a-morris james-a-morris force-pushed the james/acx-3364-implement-standard-error-structure-in-the-api branch from dc9cedb to e9ae2ea Compare November 25, 2024 20:47
@james-a-morris james-a-morris changed the base branch from james/add-error-package to master November 25, 2024 20:47
@james-a-morris james-a-morris marked this pull request as ready for review November 25, 2024 20:48
Copy link
Contributor

@melisaguevara melisaguevara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@james-a-morris james-a-morris force-pushed the james/acx-3364-implement-standard-error-structure-in-the-api branch from 8c54f8a to c3b2187 Compare November 26, 2024 14:56
Comment on lines -20 to -30

/**
* A function used by `JSON.stringify` to specify which data will be serialized
* @returns A formatted JSON
*/
public toJSON(): Record<string, unknown> {
return {
statusCode: this.httpStatusCode,
...super.toJSON(),
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOC why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would add the status code to the response code but this info is already exposed via the http status code that will get thrown.

packages/indexer-api/src/error-handler.ts Outdated Show resolved Hide resolved
@amateima amateima merged commit df6c94d into master Nov 27, 2024
3 checks passed
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.

3 participants