You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's wide usage of map_err in a variety of functions. It's mostly used to make sure that the correct account name is attached to an error. This is very useful but unfortunately in some cases it caused stack overflow which we solved by using a lazy eval and just matched the result #2313 .
From the rust docs for ok_or and ok_or_else
Arguments passed to ok_or are eagerly evaluated; if you are passing the result of a function call, it is recommended to use ok_or_else, which is lazily evaluated.
However there is no ok_or_else_map_err function, so we might have to make one that copies the functionality of the match statements and replace the map_err instances with this new function instead. It would look cleaner using our own custom function instead of writing out the length match statement everywhere anyway.
It's possible this won't be needed long term if people don't run into many stack errors but it's worth being aware of the issue and a potential solution if the need arises.
The text was updated successfully, but these errors were encountered:
There's wide usage of
map_err
in a variety of functions. It's mostly used to make sure that the correct account name is attached to an error. This is very useful but unfortunately in some cases it caused stack overflow which we solved by using a lazy eval and just matched the result #2313 .From the rust docs for
ok_or
andok_or_else
However there is no
ok_or_else_map_err
function, so we might have to make one that copies the functionality of the match statements and replace themap_err
instances with this new function instead. It would look cleaner using our own custom function instead of writing out the length match statement everywhere anyway.It's possible this won't be needed long term if people don't run into many stack errors but it's worth being aware of the issue and a potential solution if the need arises.
The text was updated successfully, but these errors were encountered: