request errors for 401 or >= 502 are handled in fetcher global error hook
This commit is contained in:
@@ -9,10 +9,13 @@ const status = ref(0);
|
||||
const message = ref('');
|
||||
const stackTrace = ref('');
|
||||
|
||||
async function onRequestError(error) {
|
||||
async function onError(error) {
|
||||
// this is handled by the fetcher global error hook
|
||||
if (error.status === 401 || error.status >= 502) return;
|
||||
|
||||
console.error(error);
|
||||
|
||||
status.value = error.status || 'unknown';
|
||||
status.value = error.status || 0;
|
||||
message.value = error.body?.message || error.message || 'unkown';
|
||||
|
||||
let stack = '';
|
||||
@@ -29,7 +32,7 @@ async function onRequestError(error) {
|
||||
}
|
||||
|
||||
if (!window.cloudron) window.cloudron = {};
|
||||
window.cloudron.onRequestError = onRequestError;
|
||||
window.cloudron.onError = onError;
|
||||
|
||||
function onClose() {
|
||||
status.value = 0;
|
||||
@@ -45,8 +48,8 @@ function onClose() {
|
||||
@close="onClose"
|
||||
>
|
||||
<div>
|
||||
<label>Status:</label>
|
||||
<pre>{{ status }}</pre>
|
||||
<label v-if="status">Status:</label>
|
||||
<pre v-if="status">{{ status }}</pre>
|
||||
<label>Details:</label>
|
||||
<pre>{{ message }}</pre>
|
||||
<label>Trace:</label>
|
||||
|
||||
Reference in New Issue
Block a user