Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 6 additions & 14 deletions dist/ethjs-query.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ethjs-query.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/ethjs-query.min.js

Large diffs are not rendered by default.

20 changes: 6 additions & 14 deletions src/index.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -86,22 +86,14 @@ function generateFnFor(rpcMethodName, methodObject) {
this.rpc.sendAsync({ method: rpcMethodName, params: inputs })
.then(result => {
// format result
try {
this.log(`attempting method formatting for '${protoMethodName}' with raw outputs: ${JSON.stringify(result, null, this.options.jsonSpace)}`);
const methodOutputs = format.formatOutputs(rpcMethodName, result);
this.log(`method formatting success for '${protoMethodName}' formatted result: ${JSON.stringify(methodOutputs, null, this.options.jsonSpace)}`);
resolve(methodOutputs);
return;
} catch (outputFormattingError) {
const outputError = new Error(`[ethjs-query] while formatting outputs from RPC '${JSON.stringify(result, null, this.options.jsonSpace)}' for method '${protoMethodName}' ${outputFormattingError}`);
reject(outputError);
return;
}
this.log(`attempting method formatting for '${protoMethodName}' with raw outputs: ${JSON.stringify(result, null, this.options.jsonSpace)}`);
const methodOutputs = format.formatOutputs(rpcMethodName, result);
this.log(`method formatting success for '${protoMethodName}' formatted result: ${JSON.stringify(methodOutputs, null, this.options.jsonSpace)}`);
resolve(methodOutputs);
return;
})
.catch(error => {
const outputError = new Error(`[ethjs-query] while formatting outputs from RPC '${JSON.stringify(error, null, this.options.jsonSpace)}'`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brad-decker any idea why this catching and rethrowing was done this way in the first place?

reject(outputError);
return;
reject(error);
});
});
}
Expand Down