Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ export class HttpRemoteFileSystem implements RemoteFileSystem {
if (error.cause === 'TOO_MANY_REQUESTS') {
return left(new DriveDesktopError('RATE_LIMITED', String(parseRetryAfterMs(error.message))));
}
if (error.cause === 'SERVER_ERROR') {
if (error.cause === 'NETWORK_ERROR' || error.cause === 'SERVER_ERROR') {
return left(new DriveDesktopError('INTERNAL_SERVER_ERROR'));
}

return left(new DriveDesktopError('UNKNOWN'));
}
return left(new DriveDesktopError('UNKNOWN'));
}
Expand Down
4 changes: 3 additions & 1 deletion src/infra/drive-server/drive-server.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ export function createClient<T>(opts: ClientOptions) {
if (isAxiosError(error)) {
const status = error.response?.status;
const message = error.response?.data?.message ?? error.message;
const cause = status ? mapStatusToErrorCause(status) : 'UNKNOWN';
const cause = status ? mapStatusToErrorCause(status) : 'NETWORK_ERROR';

return { error: new DriveServerError(cause, status, message) };
}

return {
error: new DriveServerError('UNKNOWN', undefined, error instanceof Error ? error.message : 'Unexpected error'),
};
Expand Down
Loading