Spaces:
Sleeping

asd / src /libs /shared /error /ErrorBuilder.ts
GitHub Actions
deploy: clean snapshot
7f81110
Raw History Blame Contribute Delete
465 Bytes
import { ApiError } from "../api/ApiError";
export class ErrorBuilder {
static unauthorized(message = "Unauthorized"): ApiError {
return new ApiError(401, "UNAUTHORIZED", message);
}
static notFound(resource: string): ApiError {
return new ApiError(404, "NOT_FOUND", `${resource} not found`);
}
static internal(message = "Internal server error"): ApiError {
return new ApiError(500, "INTERNAL_ERROR", message);
}
}