mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Small simpleFetch improvement
This commit is contained in:
@@ -484,4 +484,4 @@ const { candles, timeStart, timeEnd } = await simpleFetch(
|
|||||||
|
|
||||||
## Using contracts
|
## Using contracts
|
||||||
|
|
||||||
Use package [@prionprotocol/contracts](https://github.com/orionprotocol/contracts)
|
Use package [@orionprotocol/contracts](https://github.com/orionprotocol/contracts)
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ export default function simpleFetch<O, I, EO, EI, P extends unknown[]>(
|
|||||||
) {
|
) {
|
||||||
return async (...params: Parameters<typeof f>) => {
|
return async (...params: Parameters<typeof f>) => {
|
||||||
const result = await f(...params);
|
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;
|
return result.value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user