mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-04 17:10:24 +01:00
21 lines
626 B
TypeScript
21 lines
626 B
TypeScript
import * as Constants from "../Constants";
|
|
import { sendMessage } from "../MessageHandler";
|
|
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
|
|
|
interface CosmosError {
|
|
code: number;
|
|
message?: string;
|
|
}
|
|
|
|
export function sendNotificationForError(error: CosmosError): void {
|
|
if (error && error.code === Constants.HttpStatusCodes.Forbidden) {
|
|
if (error.message && error.message.toLowerCase().indexOf("sharedoffer is disabled for your account") > 0) {
|
|
return;
|
|
}
|
|
sendMessage({
|
|
type: MessageTypes.ForbiddenError,
|
|
reason: error && error.message ? error.message : error
|
|
});
|
|
}
|
|
}
|