nice-grpc-web
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -45,13 +45,22 @@ "use strict"; | ||
} | ||
async function* handleTransportErrors() { | ||
try { | ||
return yield* channel.transport({ | ||
url: channel.address + definition.path, | ||
metadata: finalMetadata, | ||
body: (0, encodeRequest_1.encodeRequest)({ | ||
request: interceptRequestError(), | ||
encode: definition.requestSerialize, | ||
}), | ||
signal: innerAbortController.signal, | ||
method: definition, | ||
}); | ||
} | ||
catch (err) { | ||
(0, abort_controller_x_1.rethrowAbortError)(err); | ||
throw new nice_grpc_common_1.ClientError(definition.path, nice_grpc_common_1.Status.UNKNOWN, `Transport error: ${(0, makeInternalErrorMessage_1.makeInternalErrorMessage)(err)}`); | ||
} | ||
} | ||
const response = (0, decodeResponse_1.decodeResponse)({ | ||
response: channel.transport({ | ||
url: channel.address + definition.path, | ||
metadata: finalMetadata, | ||
body: (0, encodeRequest_1.encodeRequest)({ | ||
request: interceptRequestError(), | ||
encode: definition.requestSerialize, | ||
}), | ||
signal: innerAbortController.signal, | ||
method: definition, | ||
}), | ||
response: handleTransportErrors(), | ||
decode: definition.responseDeserialize, | ||
@@ -90,3 +99,3 @@ onHeader(header) { | ||
if (status == null) { | ||
throw new nice_grpc_common_1.ClientError(definition.path, nice_grpc_common_1.Status.INTERNAL, 'Server did not return a status'); | ||
throw new nice_grpc_common_1.ClientError(definition.path, nice_grpc_common_1.Status.UNKNOWN, 'Response stream closed without gRPC status'); | ||
} | ||
@@ -93,0 +102,0 @@ else if (status !== nice_grpc_common_1.Status.OK) { |
{ | ||
"name": "nice-grpc-web", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "A Browser gRPC library that is nice to you", | ||
@@ -86,3 +86,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "02348455b53d8478dd84d2629a98bb37c28d0cd5" | ||
"gitHead": "73c5c3c16e75b281b9f16b15b33f094f513b0939" | ||
} |
@@ -1,2 +0,2 @@ | ||
import {isAbortError} from 'abort-controller-x'; | ||
import {isAbortError, rethrowAbortError} from 'abort-controller-x'; | ||
import {CallOptions, ClientError, Metadata, Status} from 'nice-grpc-common'; | ||
@@ -66,13 +66,27 @@ import {MethodDefinition} from '../service-definitions'; | ||
async function* handleTransportErrors() { | ||
try { | ||
return yield* channel.transport({ | ||
url: channel.address + definition.path, | ||
metadata: finalMetadata, | ||
body: encodeRequest({ | ||
request: interceptRequestError(), | ||
encode: definition.requestSerialize, | ||
}), | ||
signal: innerAbortController.signal, | ||
method: definition, | ||
}); | ||
} catch (err) { | ||
rethrowAbortError(err); | ||
throw new ClientError( | ||
definition.path, | ||
Status.UNKNOWN, | ||
`Transport error: ${makeInternalErrorMessage(err)}`, | ||
); | ||
} | ||
} | ||
const response = decodeResponse({ | ||
response: channel.transport({ | ||
url: channel.address + definition.path, | ||
metadata: finalMetadata, | ||
body: encodeRequest({ | ||
request: interceptRequestError(), | ||
encode: definition.requestSerialize, | ||
}), | ||
signal: innerAbortController.signal, | ||
method: definition, | ||
}), | ||
response: handleTransportErrors(), | ||
decode: definition.responseDeserialize, | ||
@@ -115,4 +129,4 @@ onHeader(header) { | ||
definition.path, | ||
Status.INTERNAL, | ||
'Server did not return a status', | ||
Status.UNKNOWN, | ||
'Response stream closed without gRPC status', | ||
); | ||
@@ -119,0 +133,0 @@ } else if (status !== Status.OK) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171334
3209