mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-26 15:47:40 +03:00
Small simpleFetch improvement
This commit is contained in:
@@ -21,7 +21,10 @@ export default function simpleFetch<O, I, EO, EI, P extends unknown[]>(
|
||||
) {
|
||||
return async (...params: Parameters<typeof f>) => {
|
||||
const result = await f(...params);
|
||||
if (result.isErr()) throw new Error(result.error.message);
|
||||
if (result.isErr()) {
|
||||
const { message, url } = result.error;
|
||||
throw new Error(`${message} (${url})`);
|
||||
}
|
||||
return result.value;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user