@volant-autonomy/via-sdk 1.3816.1 → 1.3832.1
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.cjs.js +26 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +26 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/volant-schema.d.ts +2 -8
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -784,7 +784,7 @@ function defaultPathSerializer(pathname, pathParams) {
|
|
|
784
784
|
return nextURL;
|
|
785
785
|
}
|
|
786
786
|
|
|
787
|
-
var version = "1.
|
|
787
|
+
var version = "1.3832.1";
|
|
788
788
|
|
|
789
789
|
const querySerializer = createQuerySerializer();
|
|
790
790
|
class Fetcher {
|
|
@@ -840,10 +840,30 @@ class Fetcher {
|
|
|
840
840
|
}
|
|
841
841
|
/** Transforms an error from the api into an {@link SdkErrorModel} */
|
|
842
842
|
async parseError(response) {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
// NOTE:
|
|
846
|
-
|
|
843
|
+
const data = await response.text();
|
|
844
|
+
let errorData;
|
|
845
|
+
// NOTE: This function does not handle the case where the API returns valid json
|
|
846
|
+
// that does not fit the schema (as in the `errors` list is missing)
|
|
847
|
+
try {
|
|
848
|
+
errorData = JSON.parse(data);
|
|
849
|
+
}
|
|
850
|
+
catch (err) {
|
|
851
|
+
if (err instanceof SyntaxError) {
|
|
852
|
+
return {
|
|
853
|
+
status: String(response.status),
|
|
854
|
+
errors: [
|
|
855
|
+
{
|
|
856
|
+
status: String(response.status),
|
|
857
|
+
detail: data
|
|
858
|
+
}
|
|
859
|
+
]
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
throw err;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
if (errorData.errors.length === 0) {
|
|
847
867
|
return {
|
|
848
868
|
status: String(response.status),
|
|
849
869
|
errors: [
|
|
@@ -857,7 +877,7 @@ class Fetcher {
|
|
|
857
877
|
else {
|
|
858
878
|
return {
|
|
859
879
|
status: String(response.status),
|
|
860
|
-
errors:
|
|
880
|
+
errors: errorData.errors.map((err) => {
|
|
861
881
|
return {
|
|
862
882
|
status: String(err.status),
|
|
863
883
|
detail: err.detail
|