Skip to content
Merged
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
13 changes: 8 additions & 5 deletions packages/rollup-full-node/src/app/routing-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class RoutingHandler implements FullnodeHandler {
* @param method The Ethereum JSON RPC method.
* @param params The parameters.
* @param sourceIpAddress The requesting IP address.
* @throws FormattedJsonRpcError if the proxied response is a JsonRpcErrorResponse
*/
public async handleRequest(
method: string,
Expand Down Expand Up @@ -102,8 +103,9 @@ export class RoutingHandler implements FullnodeHandler {

this.assertDestinationValid(tx)

let result: JsonRpcResponse
try {
const result: JsonRpcResponse =
result =
methodsToRouteWithTransactionHandler.indexOf(method) >= 0
? await this.transactionClient.makeRpcCall(method, params)
: await this.readOnlyClient.makeRpcCall(method, params)
Expand All @@ -112,10 +114,6 @@ export class RoutingHandler implements FullnodeHandler {
params
)}] got result [${JSON.stringify(result)}]`
)
if (isJsonRpcErrorResponse(result)) {
throw new FormattedJsonRpcError(result as JsonRpcErrorResponse)
}
return result.result
} catch (e) {
logError(
log,
Expand All @@ -126,6 +124,11 @@ export class RoutingHandler implements FullnodeHandler {
)
throw e
}

if (isJsonRpcErrorResponse(result)) {
throw new FormattedJsonRpcError(result as JsonRpcErrorResponse)
}
return result.result
}

/**
Expand Down