@cellaware/utils 8.7.6 → 8.7.8
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.
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throws error if `res` is not ok.
|
|
3
|
+
*
|
|
4
|
+
* **Note:** will throw message 'An error occurred. Please try again in a moment.' if none provided.
|
|
5
|
+
*/
|
|
6
|
+
export declare function assertResponseOk(res: Response, message?: string): Response;
|
|
1
7
|
export interface ChatWMSResponse {
|
|
2
8
|
ok: boolean;
|
|
3
9
|
error: string;
|
package/dist/chatwms/response.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
const RESPONSE_ERROR_MESSAGE = 'An error occurred. Please try again in a moment.';
|
|
2
|
+
/**
|
|
3
|
+
* Throws error if `res` is not ok.
|
|
4
|
+
*
|
|
5
|
+
* **Note:** will throw message 'An error occurred. Please try again in a moment.' if none provided.
|
|
6
|
+
*/
|
|
7
|
+
export function assertResponseOk(res, message) {
|
|
8
|
+
if (!res.ok) {
|
|
9
|
+
throw new Error(message ?? RESPONSE_ERROR_MESSAGE);
|
|
10
|
+
}
|
|
11
|
+
return res;
|
|
12
|
+
}
|
|
1
13
|
/**
|
|
2
14
|
* Initialization:
|
|
3
15
|
* - `ok`: `true`
|