parent
fcd50df49d
commit
1149a20b89
|
|
@ -1,6 +1,8 @@
|
||||||
import {
|
import {
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
LibreCcmApiClient,
|
LibreCcmApiClient,
|
||||||
|
ApiError,
|
||||||
|
ApiClientError,
|
||||||
} from "@libreccm/ccm-apiclient-commons";
|
} from "@libreccm/ccm-apiclient-commons";
|
||||||
|
|
||||||
import * as Constants from "../constants";
|
import * as Constants from "../constants";
|
||||||
|
|
@ -23,11 +25,22 @@ export class SystemInformationClient {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return (await response.json()) as Record<string, string>;
|
return (await response.json()) as Record<string, string>;
|
||||||
} else {
|
} else {
|
||||||
throw `Failed get system information:
|
throw new ApiError(
|
||||||
${response.status} ${response.statusText}`;
|
response.status,
|
||||||
|
response.statusText,
|
||||||
|
"get",
|
||||||
|
"Failed to get system information",
|
||||||
|
this.#SYSINFO_API_PREFIX
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw `Failed to get system information: ${err}`;
|
if (err instanceof ApiError) {
|
||||||
|
throw err;
|
||||||
|
} else {
|
||||||
|
throw new ApiClientError(
|
||||||
|
`Failed to get system information: ${err}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue