Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fetch middleware to preserve original error data #349

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* Create middleware for sending a JSON-RPC request to the given RPC URL.
*
* @param options - Options

Check warning on line 37 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

JSDoc description does not satisfy the regex pattern

Check warning on line 37 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

JSDoc description does not satisfy the regex pattern

Check warning on line 37 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

JSDoc description does not satisfy the regex pattern
* @param options.btoa - Generates a base64-encoded string from a binary string.
* @param options.fetch - The `fetch` function; expected to be equivalent to `window.fetch`.
* @param options.rpcUrl - The URL to send the request to.
Expand Down Expand Up @@ -130,9 +130,7 @@

// check for rpc error
if (body.error) {
throw rpcErrors.internal({
data: body.error,
});
throw rpcErrors.internal(body.error);
}
// return successful result
return body.result;
Expand All @@ -141,12 +139,12 @@
/**
* Generate `fetch` configuration for sending the given request to an RPC API.
*
* @param options - Options

Check warning on line 142 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

JSDoc description does not satisfy the regex pattern

Check warning on line 142 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

JSDoc description does not satisfy the regex pattern

Check warning on line 142 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

JSDoc description does not satisfy the regex pattern
* @param options.btoa - Generates a base64-encoded string from a binary string.
* @param options.rpcUrl - The URL to send the request to.
* @param options.originHttpHeaderKey - If provider, the origin field for each JSON-RPC request
* will be attached to each outgoing fetch request under this header.
* @param options.req

Check warning on line 147 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

Missing JSDoc @param "options.req" description

Check warning on line 147 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

Missing JSDoc @param "options.req" description

Check warning on line 147 in src/fetch.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (22.x)

Missing JSDoc @param "options.req" description
* @returns The fetch middleware.
*/
export function createFetchConfigFromReq({
Expand Down
Loading