Skip to content

Commit a91caf1

Browse files
authored
[papi] better grpc code for application unimplemented (#19351)
1 parent 3af824e commit a91caf1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/public-api/typescript-common/src/public-api-converter.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ import { ContextURL } from "@gitpod/gitpod-protocol/lib/context-url";
9595
import {
9696
Prebuild,
9797
PrebuildStatus,
98-
PrebuildPhase, PrebuildPhase_Phase} from "@gitpod/public-api/lib/gitpod/v1/prebuild_pb";
98+
PrebuildPhase,
99+
PrebuildPhase_Phase,
100+
} from "@gitpod/public-api/lib/gitpod/v1/prebuild_pb";
99101
import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
100102
import { InvalidGitpodYMLError, RepositoryNotFoundError, UnauthorizedRepositoryAccessError } from "./public-api-errors";
101103
import {
@@ -594,6 +596,9 @@ export class PublicAPIConverter {
594596
if (reason.code === ErrorCodes.PERMISSION_DENIED) {
595597
return new ConnectError(reason.message, Code.PermissionDenied, undefined, undefined, reason);
596598
}
599+
if (reason.code === ErrorCodes.UNIMPLEMENTED) {
600+
return new ConnectError(reason.message, Code.Unimplemented, undefined, undefined, reason);
601+
}
597602
if (reason.code === ErrorCodes.CONFLICT) {
598603
return new ConnectError(reason.message, Code.AlreadyExists, undefined, undefined, reason);
599604
}
@@ -669,6 +674,9 @@ export class PublicAPIConverter {
669674
}
670675
return new ApplicationError(ErrorCodes.PRECONDITION_FAILED, reason.rawMessage);
671676
}
677+
if (reason.code === Code.Unimplemented) {
678+
return new ApplicationError(ErrorCodes.UNIMPLEMENTED, reason.rawMessage);
679+
}
672680
if (reason.code === Code.ResourceExhausted) {
673681
return new ApplicationError(ErrorCodes.TOO_MANY_REQUESTS, reason.rawMessage);
674682
}
@@ -1139,7 +1147,7 @@ export class PublicAPIConverter {
11391147
return PrebuildPhase_Phase.UNSPECIFIED;
11401148
}
11411149

1142-
fromPrebuildPhase (status: PrebuildPhase_Phase): PrebuiltWorkspaceState | undefined {
1150+
fromPrebuildPhase(status: PrebuildPhase_Phase): PrebuiltWorkspaceState | undefined {
11431151
switch (status) {
11441152
case PrebuildPhase_Phase.QUEUED:
11451153
return "queued";

0 commit comments

Comments
 (0)