Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

fix: return a 401 when tokens can't be refreshed in API #2056

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ export class SGTerminalTooManyRequestsError extends SGSyncWorkerError {
// Throw this when you want run_object_sync to pause after the current execution
export class SGConnectionNoLongerAuthenticatedError extends SGSyncWorkerError {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is also being thrown in API, so we need to have the correct http status code for it

constructor(message: string, status?: number, cause?: Error) {
super(message, status, 'SG_CONNECTION_NO_LONGER_AUTHENTICATED_ERROR', cause);
super(message, status ?? 401, 'SG_CONNECTION_NO_LONGER_AUTHENTICATED_ERROR', cause);
}
}