feat(ui): changed to a better toast for ui and a global error handler for all server error messages

This commit is contained in:
Akhil Mohan
2024-03-26 19:37:13 +05:30
parent 1f939a5e58
commit 282434de8e
105 changed files with 355 additions and 382 deletions
+22
View File
@@ -1,3 +1,5 @@
import { ZodIssue } from "zod";
export type { GetAuthTokenAPI } from "./auth/types";
export type { IncidentContact } from "./incidentContacts/types";
export type { IntegrationAuth } from "./integrationAuth/types";
@@ -36,3 +38,23 @@ export type {
WorkspaceEnv,
WorkspaceTag
} from "./workspace/types";
export enum ApiErrorTypes {
ValidationError = "ValidationFailure",
BadRequestError = "BadRequest",
UnauthorizedError = "UnauthorizedError",
ForbiddenError = "PermissionDenied"
}
export type TApiErrors =
| {
error: ApiErrorTypes.ValidationError;
message: ZodIssue[];
statusCode: 403;
}
| { error: ApiErrorTypes.ForbiddenError; message: string; statusCode: 401 }
| {
statusCode: 400;
message: string;
error: ApiErrorTypes.BadRequestError;
};