Skip to content

fix: issues 4 and 6#7

Open
frolvanya wants to merge 1 commit intomainfrom
fix/issues-4-and-6
Open

fix: issues 4 and 6#7
frolvanya wants to merge 1 commit intomainfrom
fix/issues-4-and-6

Conversation

@frolvanya
Copy link
Copy Markdown
Contributor

closes #4, #6

@frolvanya frolvanya linked an issue Mar 30, 2026 that may be closed by this pull request
impl<T, E: core::fmt::Debug> NearExpect<T> for Result<T, E> {
fn near_expect(self, msg: impl AsRef<str>) -> T {
self.unwrap_or_else(|_| near_sdk::env::panic_str(msg.as_ref()))
self.unwrap_or_else(|err| near_sdk::env::panic_str(&format!("{}: {:?}", msg.as_ref(), err)))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@olga24912 I'm still not sure about this, we have a lot of places like result.near_expect("ERR_XYZ") and later we check if err == ERR_XYZ. I'm not sure that adding extra context is good

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.

Q: Is process_fn branch in #[trusted_relayer] needed? INFO. NearExpect for Result: include original error in panic message

1 participant