@typespec/ts-http-runtime 1.0.0-alpha.20231121.3 → 1.0.0-alpha.20231129.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -3109,14 +3109,18 @@ async function computeSha256Hash(content, encoding) {
|
|
|
3109
3109
|
|
|
3110
3110
|
// Copyright (c) Microsoft Corporation.
|
|
3111
3111
|
// Licensed under the MIT license.
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3112
|
+
function createRestError(messageOrResponse, response) {
|
|
3113
|
+
var _a;
|
|
3114
|
+
const resp = typeof messageOrResponse === "string" ? response : messageOrResponse;
|
|
3115
|
+
const internalError = resp.body.error || resp.body;
|
|
3116
|
+
const message = typeof messageOrResponse === "string"
|
|
3117
|
+
? messageOrResponse
|
|
3118
|
+
: (_a = internalError.message) !== null && _a !== void 0 ? _a : `Unexpected status code: ${resp.status}`;
|
|
3116
3119
|
return new RestError(message, {
|
|
3117
|
-
statusCode: statusCodeToNumber(
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
+
statusCode: statusCodeToNumber(resp.status),
|
|
3121
|
+
code: internalError.code,
|
|
3122
|
+
request: resp.request,
|
|
3123
|
+
response: toPipelineResponse(resp),
|
|
3120
3124
|
});
|
|
3121
3125
|
}
|
|
3122
3126
|
function toPipelineResponse(response) {
|