diff --git a/scripts/config.js b/scripts/config.js
index 820f7b0..9979d60 100644
--- a/scripts/config.js
+++ b/scripts/config.js
@@ -370,7 +370,7 @@ async function handleDiskAdd () {
options += `"`;
}
});
- let select = ``;
+ let select = ``;
dialog.formBody = `
@@ -420,12 +420,12 @@ async function handleCDAdd () {
storageOptions += `"`;
}
});
- let storageSelect = ``;
+ let storageSelect = ``;
dialog.formBody = `
${storageSelect}
-
+
`;
dialog.shadowRoot.querySelector("#storage-select").selectedIndex = -1;
diff --git a/scripts/utils.js b/scripts/utils.js
index dc2769e..0129b02 100644
--- a/scripts/utils.js
+++ b/scripts/utils.js
@@ -1,12 +1,5 @@
import {API} from "/vars.js";
-export class ResponseError extends Error {
- constructor(message) {
- super(message);
- this.name = "ResponseError";
- }
-}
-
export class NetworkError extends Error {
constructor(message) {
super(message);
@@ -161,16 +154,21 @@ async function request (url, content) {
return response;
})
.catch((error) => {
- throw new NetworkError(error);
+ return new NetworkError(error);
});
- if(!response.ok){
- throw new ResponseError(response);
+ if (response instanceof NetworkError) {
+ return {status: 408, error: "network error"};
+ }
+ else if(!response.ok){
+ let data = await response.json()
+ return {status: response.status, error: data.error};
+ }
+ else {
+ let data = await response.json();
+ data.status = response.status;
+ return data;
}
-
- let data = await response.json();
- data.status = response.status;
- return data;
}
export function goToPage (page, data={}, newwindow = false) {