Skip to content

Commit

Permalink
improve messaging on reflection and method selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-willis committed Jan 21, 2025
1 parent 2c352df commit a77d5d0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/insomnia/src/utils/grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const GRPC_CONNECTION_ERROR_STRINGS = {
SERVER_CANCELED: 'CANCELLED',
TLS_NOT_SUPPORTED: 'WRONG_VERSION_NUMBER',
BAD_LOCAL_ROOT_CERT: 'unable to get local issuer certificate',
UNIMPLEMENTED: 'UNIMPLEMENTED',
// this next one will break if we rename the call made from the pane
CANNOT_REFLECT: "'grpc.loadMethodsFromReflection': Error: 12",
};

export function isGrpcConnectionError(error: Error) {
Expand Down Expand Up @@ -34,6 +37,12 @@ export function getGrpcConnectionErrorDetails(error: Error) {
} else if (error.message.includes(GRPC_CONNECTION_ERROR_STRINGS.BAD_LOCAL_ROOT_CERT)) {
title = 'Local Root Certificate Error';
message = 'The local root certificate enabled for the host is not valid.\nEither disable the root certificate, or update it with a valid one.';
} else if (error.message.includes(GRPC_CONNECTION_ERROR_STRINGS.CANNOT_REFLECT)) {
title = 'Reflection Not Supported';
message = 'The server has indicated that it does not support reflection. You may need to manually enable it server-side.';
} else if (error.message.includes(GRPC_CONNECTION_ERROR_STRINGS.UNIMPLEMENTED)) {
title = 'Unimplemented Method';
message = 'The server does not support the requested method. Is the .proto file correct?';
}

return {
Expand Down

0 comments on commit a77d5d0

Please sign in to comment.