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

Add action context to contract error message #1744

Merged

Conversation

YaroShkvorets
Copy link
Contributor

This PR addresses #1743

I'm adding contract::action @ receiver in front of pending console output but let me know if there are other considerations.

@@ -131,7 +131,7 @@ void apply_context::exec_one()
}
}
}
} FC_RETHROW_EXCEPTIONS( warn, "pending console output: ${console}", ("console", _pending_console_output) )
} FC_RETHROW_EXCEPTIONS( warn, "${account}::${action} @ ${receiver} pending console output: ${console}", ("console", _pending_console_output)("account", act->account)("action", act->name)("receiver", receiver) )
Copy link
Member

Choose a reason for hiding this comment

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

cleos outputs this as ${receiver} <= ${account}::${action}. I'm not sure it matters much but would be interested if anyone has a preference. @arhag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that.

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a strong preference how those three pieces of information should be presented. I agree it is a great developer experience improvement to include it though in whichever from.

I'm wondering if we should also include the action_ordinal to disambiguate which one it comes from if there were multiple instances of the same action and receiver. But then again, even without this change, the transaction trace should already have enough information to determine which exact action within the trace the error came from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to ${receiver} <= ${account}::${action}.

I feel like the meaning of action_ordinal number would be hard to figure out for the developers, so would be more confusing than helpful. But maybe it's just me.

@heifner heifner requested a review from greg7mdp October 11, 2023 12:24
@heifner heifner linked an issue Oct 11, 2023 that may be closed by this pull request
@heifner heifner merged commit a1a3029 into AntelopeIO:main Oct 11, 2023
21 checks passed
@heifner
Copy link
Member

heifner commented Oct 11, 2023

Thank you @YaroShkvorets

@YaroShkvorets YaroShkvorets deleted the GH-1743-add-context-to-exceptions branch October 11, 2023 13:08
@ericpassmore
Copy link
Contributor

Note:start
group: CONTRACTS
category: LOGGING
summary: Improve debugging for inline actions by adding additional context of the account that owns the action, the action that failed, and the receiver (to distinguish action calls from notification handlers)
Note:end

@YaroShkvorets
Copy link
Contributor Author

Curious @heifner is it too late to merge this into release/5.0 branch?

@heifner
Copy link
Member

heifner commented Nov 14, 2023

Curious @heifner is it too late to merge this into release/5.0 branch?

@bhazzard

@bhazzard
Copy link

Looks like little to no risk for this one. @YaroShkvorets please merge it to release/5.0

@YaroShkvorets YaroShkvorets restored the GH-1743-add-context-to-exceptions branch November 14, 2023 21:29
@YaroShkvorets
Copy link
Contributor Author

Thanks. Opened: #1902

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.

Add context to contract exceptions
6 participants