Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit e4e5f23

Browse files
committed
Clean up
1 parent a71061a commit e4e5f23

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

framework/core/fetch_error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export default class FetchError extends Error {
2626
if (typeof data.message === "string") {
2727
message = data.message;
2828
}
29-
if (typeof data.details === "object" && data.details !== null) {
30-
details = data.details;
29+
if (data.details !== null && typeof data.details === "object" && !Array.isArray(data.details)) {
30+
details = { ...details, ...data.detials };
3131
}
3232
} else {
3333
message = await res.text();

lib/util.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
return Array.isArray(a) && a.length > 0;
1515
},
1616
isPlainObject<T = Record<string, unknown>>(a: unknown): a is T {
17-
return typeof a === "object" && a !== null && Object.getPrototypeOf(a) === Object.prototype;
17+
return a !== null && typeof a === "object" && Object.getPrototypeOf(a) === Object.prototype;
1818
},
1919
isLikelyHttpURL(s: string): boolean {
2020
const p = s.slice(0, 8).toLowerCase();
@@ -68,12 +68,11 @@ export default {
6868
const bytes = new Uint8Array(buffer);
6969
return [...bytes].map((b) => b.toString(16).padStart(2, "0")).join("");
7070
},
71-
async computeHash(algorithm: AlgorithmIdentifier, data: string | Uint8Array): Promise<string> {
72-
const sum = await crypto.subtle.digest(
71+
computeHash(algorithm: AlgorithmIdentifier, data: string | Uint8Array): Promise<string> {
72+
return crypto.subtle.digest(
7373
algorithm,
7474
typeof data === "string" ? this.utf8TextEncoder.encode(data) : data,
75-
);
76-
return this.toHex(sum);
75+
).then((sum) => this.toHex(sum));
7776
},
7877
prettyBytes(bytes: number) {
7978
const units = ["", "K", "M", "G", "T", "P", "E"];

0 commit comments

Comments
 (0)