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

Caller now can now pass error as string (old behavior) or dictionary #39

Conversation

hboon
Copy link
Member

@hboon hboon commented Mar 5, 2023

Close #38

@hboon hboon requested a review from oa-s March 5, 2023 02:05
@@ -39974,7 +39974,7 @@ var AlphaWallet = {
var callback = callbacks[id];

if (callback.isRPC) {
var response = { 'id': id, jsonrpc: '2.0', result: value, error: { message: error } };
var response = { 'id': id, jsonrpc: '2.0', result: value, error: error };
Copy link
Member Author

Choose a reason for hiding this comment

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

@oa-s is it better to check error if it's just a string and keep the old behavior?

if error is string //I forgot my JavaScript
    error: { message: error }
else
    error: error
end

Copy link

Choose a reason for hiding this comment

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

yes, looks good

@@ -39974,7 +39974,7 @@ var AlphaWallet = {
var callback = callbacks[id];

if (callback.isRPC) {
var response = { 'id': id, jsonrpc: '2.0', result: value, error: { message: error } };
var response = { 'id': id, jsonrpc: '2.0', result: value, error: error };
Copy link

Choose a reason for hiding this comment

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

yes, looks good

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…an now also pass a dictionary instead
@hboon hboon force-pushed the caller-now-needs-to-pass-in-error-dictionary-instead-of-just-a-string-message branch from e21ccf1 to 2a1121c Compare March 6, 2023 02:23
@hboon
Copy link
Member Author

hboon commented Mar 6, 2023

Force-pushed so the error passed to the callback can be a string (old behavior) as well as a dictionary

@hboon hboon changed the title Caller now needs to pass in error (dictionary) instead of just a string message Caller now can now pass error as string (old behavior) or dictionary Mar 6, 2023
@hboon hboon merged commit bdb38b0 into master Mar 6, 2023
@hboon hboon deleted the caller-now-needs-to-pass-in-error-dictionary-instead-of-just-a-string-message branch March 6, 2023 02:25
@hboon
Copy link
Member Author

hboon commented Mar 6, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update passing string as error with object
2 participants