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 response.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { error: response.error };
|
return {
|
||||||
|
error: {
|
||||||
|
...response.body.error,
|
||||||
|
statusCode: response.status,
|
||||||
|
},
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,13 @@ import {
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class MicrosoftHandleErrorService {
|
export class MicrosoftHandleErrorService {
|
||||||
public handleMicrosoftMessageFetchError(error: GraphError): void {
|
public handleMicrosoftMessageFetchError(error: GraphError): void {
|
||||||
|
if (!error.statusCode) {
|
||||||
|
throw new MessageImportDriverException(
|
||||||
|
`Microsoft Graph API unknown error: ${error}`,
|
||||||
|
MessageImportDriverExceptionCode.UNKNOWN,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (error.statusCode === 401) {
|
if (error.statusCode === 401) {
|
||||||
throw new MessageImportDriverException(
|
throw new MessageImportDriverException(
|
||||||
'Unauthorized access to Microsoft Graph API',
|
'Unauthorized access to Microsoft Graph API',
|
||||||
|
|||||||
@ -91,8 +91,10 @@ export class MessageImportExceptionHandlerService {
|
|||||||
[messageChannel.id],
|
[messageChannel.id],
|
||||||
workspaceId,
|
workspaceId,
|
||||||
);
|
);
|
||||||
|
throw new MessageImportException(
|
||||||
return;
|
`Unknown error occurred multiple times while importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}`,
|
||||||
|
MessageImportExceptionCode.UNKNOWN,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const messageChannelRepository =
|
const messageChannelRepository =
|
||||||
|
|||||||
Reference in New Issue
Block a user