@aptly-as/app-sdk
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -47,17 +47,36 @@ import { AptlyApiError, AptlyErrorCode } from '@aptly-as/types'; | ||
if (response.status > 299) { | ||
throw new AptlyApiError(await response.json()); | ||
try { | ||
const error = await response.json(); | ||
throw new AptlyApiError(error); | ||
} | ||
catch (error) { | ||
throw new AptlyApiError({ | ||
status: String(response.status), | ||
response, | ||
title: response.statusText, | ||
code: AptlyErrorCode.Default, | ||
detail: 'Failed to parse json on error', | ||
id: 'none', | ||
error, | ||
}); | ||
} | ||
} | ||
return (await response.json()); | ||
try { | ||
return (await response.json()); | ||
} | ||
catch (error) { | ||
throw new AptlyApiError({ | ||
status: String(response?.status || 500), | ||
detail: 'Failed to parse json', | ||
code: AptlyErrorCode.Default, | ||
link: '', | ||
title: 'Failed to parse json', | ||
id: 'none', | ||
error, | ||
response: response | ||
}); | ||
} | ||
} | ||
catch (error) { | ||
throw new AptlyApiError({ | ||
status: String(response?.status || 500), | ||
detail: 'Failed to parse json', | ||
code: AptlyErrorCode.Default, | ||
link: '', | ||
title: 'Failed to parse json', | ||
id: 'none', | ||
error, | ||
response: response | ||
}); | ||
throw error; | ||
} | ||
@@ -64,0 +83,0 @@ finally { |
{ | ||
"name": "@aptly-as/app-sdk", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Aptly app SDK library for app communication and frontend development", | ||
@@ -8,3 +8,3 @@ "type": "module", | ||
"scripts": { | ||
"start": "tsc --watch", | ||
"dev": "tsc --watch", | ||
"build": "tsc", | ||
@@ -11,0 +11,0 @@ "test:watch": "mocha --parallel --watch", |
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
27052
668