Skip to Content

Function fromServiceError

  • Translate a gRPC failure into the error that says what happened.

    Returns rather than throws, so a caller can add context before raising.

    The mapping is by status code, with FAILED_PRECONDITION splitting further: when the call carries a Memco-scoped google.rpc.ErrorInfo naming a sunset, the result is a MemcoSunsetError. Any code with no entry becomes a MemcoInternalError, which is where an unrecognised status belongs — it is not something the caller did.

    Parameters

    • error: Partial<ServiceError>

      The rejection @grpc/grpc-js produced.

    Returns MemcoAPIError

    The typed error to raise.