diff --git a/lib/exceptions/no-content.exception.ts b/lib/exceptions/no-content.exception.ts new file mode 100644 index 0000000..d3b9c6c --- /dev/null +++ b/lib/exceptions/no-content.exception.ts @@ -0,0 +1,9 @@ +import { status } from "@grpc/grpc-js"; +import { RpcException } from "@nestjs/microservices"; +import { errorObject } from "../utils"; + +export class GrpcNoContentException extends RpcException { + constructor(error: string | object) { + super(errorObject(error, status.NO_CONTENT)); + } +} diff --git a/lib/utils/http-codes-map.ts b/lib/utils/http-codes-map.ts index 1ceb62c..8e2ecaa 100644 --- a/lib/utils/http-codes-map.ts +++ b/lib/utils/http-codes-map.ts @@ -1,3 +1,4 @@ +/* eslint-disable prettier/prettier */ import { status as Status } from "@grpc/grpc-js"; import { HttpStatus } from "@nestjs/common"; @@ -19,4 +20,5 @@ export const HTTP_CODE_FROM_GRPC: Record = { [Status.UNAVAILABLE]: HttpStatus.NOT_FOUND, [Status.DATA_LOSS]: HttpStatus.INTERNAL_SERVER_ERROR, [Status.UNAUTHENTICATED]: HttpStatus.UNAUTHORIZED, + [Status.NO_CONTENT]: HttpStatus.NO_CONTENT, };