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

feat: make #[hanlde_result] work with fully qualified paths #854

Closed
wants to merge 1 commit into from

Conversation

itegulov
Copy link
Contributor

Fixes #852

Opening this as a draft for now since there is one unresolved thing with FunctionError impl for anyhow::Error. There is no AsRef<str> implementation for anyhow::Error and we can't implement it ourselves (or FunctionError itself) due to conflicting implementations (life is hard without specialization...).

@uint
Copy link
Contributor

uint commented Jul 12, 2023

AsRef<str> can't be implemented on anyhow::Error anyway. Since an anyhow::Error might have to build a string dynamically, there's no way to guarantee a cheap pointer cast there.

@itegulov @frol What's the rationale for having impl AsRef<str> as the SDK error type in the first place? Is it to encourage devs to produce unhappy paths that are cheap? Or is it just convenience on our side for easily getting something that we can call near_sdk::env::panic_str on? I'd like to understand our constraints and needs here.

@uint
Copy link
Contributor

uint commented Jul 20, 2023

Stale PR. Closing.

@uint uint closed this Jul 20, 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.

#[handle_result] should not rely on Result being referred to using specific tokens
2 participants