diff --git a/components/gitpod-protocol/src/messaging/error.ts b/components/gitpod-protocol/src/messaging/error.ts index f489c065dbf9f1..655edc73197949 100644 --- a/components/gitpod-protocol/src/messaging/error.ts +++ b/components/gitpod-protocol/src/messaging/error.ts @@ -5,8 +5,7 @@ */ import { scrubber } from "../util/scrubbing"; -import { ServerErrorResponse } from "@grpc/grpc-js/build/src/server-call"; -import { Status } from "@grpc/grpc-js/build/src/constants"; +import { Status } from "nice-grpc-common"; export class ApplicationError extends Error { constructor(public readonly code: ErrorCode, message: string, public readonly data?: any) { @@ -39,7 +38,9 @@ export namespace ApplicationError { } } - export function fromGRPCError(e: ServerErrorResponse, data?: any): ApplicationError { + export function fromGRPCError(e: any & Error, data?: any): ApplicationError { + // Argument e should be ServerErrorResponse + // But to reduce dependency requirement, we use Error here return new ApplicationError(categorizeRPCError(e.code), e.message, data); }