@dynatrace-sdk/app-utils
Advanced tools
Comparing version 0.4.3 to 0.5.0
@@ -5,2 +5,8 @@ # App Utils | ||
## 0.5.0 | ||
### Minor Changes | ||
- Use cause property to return whole Response when error occurs. | ||
## 0.4.3 | ||
@@ -7,0 +13,0 @@ |
@@ -44,2 +44,11 @@ /** | ||
var functions = { | ||
/** | ||
* A convenience layer for the user to communicate with an app function. | ||
* @param functionName | ||
* @param options Optional options | ||
* @param options.data An Payload of the call | ||
* @param options.abortSignal An AbortSignal to set request's signal | ||
* @throws a common Error object with a CAUSE property that contains the whole response object | ||
* @returns Response of a fetch call | ||
*/ | ||
async call(functionName, options) { | ||
@@ -51,5 +60,5 @@ const method = options?.data ? "POST" : "GET"; | ||
if (!response.ok) { | ||
throw new Error( | ||
`Function ${functionName} failed with error-code: ${response.status} ${response.statusText}` | ||
); | ||
throw new Error(`Function ${functionName} has failed`, { | ||
cause: response | ||
}); | ||
} | ||
@@ -56,0 +65,0 @@ return response; |
@@ -13,3 +13,3 @@ | ||
<div class="col" style={{textAlign: 'right'}}> | ||
<a href="https://www.npmjs.com/package/@dynatrace-sdk/app-utils/v/0.4.3" target="_blank" rel="noopener noreferrer">v0.4.3</a> | ||
<a href="https://www.npmjs.com/package/@dynatrace-sdk/app-utils/v/0.5.0" target="_blank" rel="noopener noreferrer">v0.5.0</a> | ||
</div> | ||
@@ -16,0 +16,0 @@ </div> |
@@ -19,2 +19,11 @@ /** | ||
var functions = { | ||
/** | ||
* A convenience layer for the user to communicate with an app function. | ||
* @param functionName | ||
* @param options Optional options | ||
* @param options.data An Payload of the call | ||
* @param options.abortSignal An AbortSignal to set request's signal | ||
* @throws a common Error object with a CAUSE property that contains the whole response object | ||
* @returns Response of a fetch call | ||
*/ | ||
async call(functionName, options) { | ||
@@ -26,5 +35,5 @@ const method = options?.data ? "POST" : "GET"; | ||
if (!response.ok) { | ||
throw new Error( | ||
`Function ${functionName} failed with error-code: ${response.status} ${response.statusText}` | ||
); | ||
throw new Error(`Function ${functionName} has failed`, { | ||
cause: response | ||
}); | ||
} | ||
@@ -31,0 +40,0 @@ return response; |
{ | ||
"name": "@dynatrace-sdk/app-utils", | ||
"version": "0.4.3", | ||
"version": "0.5.0", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "description": "Utilities for app function executions.", |
@@ -11,2 +11,3 @@ /** | ||
* @param options.abortSignal An AbortSignal to set request's signal | ||
* @throws a common Error object with a CAUSE property that contains the whole response object | ||
* @returns Response of a fetch call | ||
@@ -13,0 +14,0 @@ */ |
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
19024
125