Fixing unhandled exception for microsoft driver (#10223)
Fixing a difficult bug: an unhandled exception for microsoft driver when one of the many Microsoft BATCH request failed.
This commit is contained in:
@ -134,7 +134,12 @@ export class MicrosoftGetMessagesService {
|
||||
return response.body;
|
||||
}
|
||||
|
||||
return { error: response.error };
|
||||
return {
|
||||
error: {
|
||||
...response.body.error,
|
||||
statusCode: response.status,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,13 @@ import {
|
||||
@Injectable()
|
||||
export class MicrosoftHandleErrorService {
|
||||
public handleMicrosoftMessageFetchError(error: GraphError): void {
|
||||
if (!error.statusCode) {
|
||||
throw new MessageImportDriverException(
|
||||
`Microsoft Graph API unknown error: ${error}`,
|
||||
MessageImportDriverExceptionCode.UNKNOWN,
|
||||
);
|
||||
}
|
||||
|
||||
if (error.statusCode === 401) {
|
||||
throw new MessageImportDriverException(
|
||||
'Unauthorized access to Microsoft Graph API',
|
||||
|
||||
@ -91,8 +91,10 @@ export class MessageImportExceptionHandlerService {
|
||||
[messageChannel.id],
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
return;
|
||||
throw new MessageImportException(
|
||||
`Unknown error occurred multiple times while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}`,
|
||||
MessageImportExceptionCode.UNKNOWN,
|
||||
);
|
||||
}
|
||||
|
||||
const messageChannelRepository =
|
||||
|
||||
Reference in New Issue
Block a user