30 lines
696 B
TypeScript
30 lines
696 B
TypeScript
/**
|
|
* Interface of the server (auto-generated code)
|
|
*/
|
|
import { z as zod } from "zod";
|
|
|
|
import {ZodObjectId} from "./object-id";
|
|
import {ZodInteger} from "./integer";
|
|
|
|
export const ZodRestErrorResponse = zod.object({
|
|
oid: ZodObjectId.optional(),
|
|
name: zod.string(),
|
|
message: zod.string(),
|
|
time: zod.string(),
|
|
status: ZodInteger,
|
|
statusMessage: zod.string(),
|
|
|
|
});
|
|
|
|
export type RestErrorResponse = zod.infer<typeof ZodRestErrorResponse>;
|
|
|
|
export function isRestErrorResponse(data: any): data is RestErrorResponse {
|
|
try {
|
|
ZodRestErrorResponse.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodRestErrorResponse' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|