@xcelera/cli 1.3.0 → 1.4.0
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/action.js +26 -4
- package/dist/action.js.map +1 -1
- package/dist/cli.js +39 -5
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
package/dist/action.js
CHANGED
|
@@ -31282,15 +31282,37 @@ async function requestAudit(url, token, github) {
|
|
|
31282
31282
|
})
|
|
31283
31283
|
});
|
|
31284
31284
|
if (!response.ok) {
|
|
31285
|
+
// handle expected errors
|
|
31286
|
+
if (response.headers.get('content-type')?.includes('application/json')) {
|
|
31287
|
+
const errorResponse = (await response.json());
|
|
31288
|
+
return {
|
|
31289
|
+
success: false,
|
|
31290
|
+
error: {
|
|
31291
|
+
code: response.status,
|
|
31292
|
+
message: errorResponse.error,
|
|
31293
|
+
details: errorResponse.details
|
|
31294
|
+
}
|
|
31295
|
+
};
|
|
31296
|
+
}
|
|
31297
|
+
// handle unexpected errors
|
|
31285
31298
|
const errorText = await response.text();
|
|
31286
|
-
throw new Error(`
|
|
31299
|
+
throw new Error(`Operation failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
31287
31300
|
}
|
|
31288
|
-
const data = await response.json();
|
|
31289
|
-
return
|
|
31301
|
+
const data = (await response.json());
|
|
31302
|
+
return {
|
|
31303
|
+
success: true,
|
|
31304
|
+
data
|
|
31305
|
+
};
|
|
31290
31306
|
}
|
|
31291
31307
|
catch (error) {
|
|
31292
31308
|
if (isNetworkError(error)) {
|
|
31293
|
-
|
|
31309
|
+
return {
|
|
31310
|
+
success: false,
|
|
31311
|
+
error: {
|
|
31312
|
+
message: 'Network error',
|
|
31313
|
+
details: error.message
|
|
31314
|
+
}
|
|
31315
|
+
};
|
|
31294
31316
|
}
|
|
31295
31317
|
throw error;
|
|
31296
31318
|
}
|