@dynatrace-sdk/client-app-engine-registry
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -5,2 +5,11 @@ # AppEngine - Registry | ||
## 1.2.4 | ||
### Patch Changes | ||
- Update error messages | ||
- Updated dependencies | ||
- @dynatrace-sdk/http-client@1.0.5 | ||
## 1.2.3 | ||
@@ -7,0 +16,0 @@ |
@@ -81,3 +81,4 @@ /** | ||
isClientRequestError: () => isClientRequestError, | ||
isErrorEnvelopeError: () => isErrorEnvelopeError | ||
isErrorEnvelopeError: () => isErrorEnvelopeError, | ||
isInvalidResponseError: () => isInvalidResponseError | ||
}); | ||
@@ -179,2 +180,23 @@ module.exports = __toCommonJS(src_exports); | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/get-error-message.ts | ||
function getMessagesFromErrorDetails(details) { | ||
const messages = []; | ||
Object.entries(details).forEach(([name, data]) => { | ||
switch (name) { | ||
case "missingScopes": | ||
messages.push(`Missing scopes: ${data}`); | ||
break; | ||
default: | ||
messages.push(`${name}: ${data}`); | ||
} | ||
}, []); | ||
return messages; | ||
} | ||
function getErrorMessage(errorBody, defaultMessage) { | ||
const error = errorBody; | ||
const msg = error?.error?.message || defaultMessage; | ||
const details = error?.error?.details || {}; | ||
return [msg, ...getMessagesFromErrorDetails(details)].join(". "); | ||
} | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/invalid-response-error.ts | ||
@@ -195,2 +217,5 @@ var InvalidResponseError = class extends ApiClientError { | ||
}; | ||
function isInvalidResponseError(e) { | ||
return e instanceof InvalidResponseError; | ||
} | ||
@@ -904,3 +929,3 @@ // packages/client/app-engine-registry/src/lib/models/app-info-list.transformation.ts | ||
const errorBody = fromJson25(responseValue); | ||
throw new ErrorEnvelopeError("400", response, errorBody, "Bad Request"); | ||
throw new ErrorEnvelopeError("400", response, errorBody, getErrorMessage(errorBody, "Bad Request")); | ||
} catch (err) { | ||
@@ -939,3 +964,3 @@ if (err instanceof ErrorEnvelopeError) { | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`) | ||
); | ||
@@ -942,0 +967,0 @@ } |
@@ -38,3 +38,3 @@ --- | ||
<div class="col" style={{textAlign: 'right'}}> | ||
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-registry/v/1.2.3">v1.2.3</a> | ||
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-registry/v/1.2.4">v1.2.4</a> | ||
</div> | ||
@@ -41,0 +41,0 @@ </div> |
{ | ||
"dynagen": { | ||
"version": "0.10.9", | ||
"version": "0.10.10", | ||
"generatedAt": "", | ||
"template": { | ||
"name": "@dynatrace-sdk/template-typescript-client", | ||
"version": "0.17.4" | ||
"version": "0.17.6" | ||
} | ||
@@ -9,0 +9,0 @@ }, |
@@ -115,2 +115,23 @@ /** | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/get-error-message.ts | ||
function getMessagesFromErrorDetails(details) { | ||
const messages = []; | ||
Object.entries(details).forEach(([name, data]) => { | ||
switch (name) { | ||
case "missingScopes": | ||
messages.push(`Missing scopes: ${data}`); | ||
break; | ||
default: | ||
messages.push(`${name}: ${data}`); | ||
} | ||
}, []); | ||
return messages; | ||
} | ||
function getErrorMessage(errorBody, defaultMessage) { | ||
const error = errorBody; | ||
const msg = error?.error?.message || defaultMessage; | ||
const details = error?.error?.details || {}; | ||
return [msg, ...getMessagesFromErrorDetails(details)].join(". "); | ||
} | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/invalid-response-error.ts | ||
@@ -131,2 +152,5 @@ var InvalidResponseError = class extends ApiClientError { | ||
}; | ||
function isInvalidResponseError(e) { | ||
return e instanceof InvalidResponseError; | ||
} | ||
@@ -840,3 +864,3 @@ // packages/client/app-engine-registry/src/lib/models/app-info-list.transformation.ts | ||
const errorBody = fromJson25(responseValue); | ||
throw new ErrorEnvelopeError("400", response, errorBody, "Bad Request"); | ||
throw new ErrorEnvelopeError("400", response, errorBody, getErrorMessage(errorBody, "Bad Request")); | ||
} catch (err) { | ||
@@ -875,3 +899,3 @@ if (err instanceof ErrorEnvelopeError) { | ||
responseValue, | ||
`Unexpected api response: code=${response.status} body="${responseValue}"` | ||
getErrorMessage(responseValue, `Unexpected api response: code=${response.status} body="${responseValue}"`) | ||
); | ||
@@ -1168,3 +1192,4 @@ } | ||
isClientRequestError, | ||
isErrorEnvelopeError | ||
isErrorEnvelopeError, | ||
isInvalidResponseError | ||
}; |
{ | ||
"name": "@dynatrace-sdk/client-app-engine-registry", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"dependencies": { | ||
"@dynatrace-sdk/http-client": "^1.0.3" | ||
"@dynatrace-sdk/http-client": "^1.0.5" | ||
}, | ||
@@ -7,0 +7,0 @@ "license": "Apache-2.0", |
# @dynatrace-sdk/client-app-engine-registry | ||
[![npm](https://img.shields.io/badge/npm-v1.2.3-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-registry/v/1.2.3) | ||
[![npm](https://img.shields.io/badge/npm-v1.2.4-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-registry/v/1.2.4) | ||
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | ||
@@ -5,0 +5,0 @@ |
export { isClientRequestError } from './client-request-error'; | ||
export { isApiClientError } from './api-client-error'; | ||
export { isInvalidResponseError } from './invalid-response-error'; | ||
export { isErrorEnvelopeError } from './error-envelope-error'; |
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
186943
134
3845