-
Notifications
You must be signed in to change notification settings - Fork 67
enhancement: full anyhow::Result<()> support in indexers #1425
Conversation
17e8f75
to
94feba4
Compare
8f220d7
to
b1c0f44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally like this change. However, I am a bit concerned with requiring people to use a Result
; most of that concern is from whether we can expect someone to know how to use it. Is there any way that a user can still do something like a regular fn index_block(...)
without having the handler return a Result
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'll echo @deekerno a bit here
anyhow::Result
should be changed to justResult
in all cases where possible- And since all handler functions are returning
Result<()>
this seems a bit...odd - as it's only used to report errors that might have happened- Not saying that's not important, but the UX seems a bit off
f803a10
to
5819f1c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 🔥 Will defer to @deekerno
…rror-support-in-indexers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Closes #1409.
This PR changes the
indexer
macro to allow writing functions with aResult
type and adds a mechanism to extract the error message from the WASM module. This is done the same way as with panic hook—by storing the message in astatic mut
String
.The error message automatically includes the block height as well as the name of the failing handler. Multiple errors from multiple handlers can be reported at once.
Testing steps
Deploy an indexer that returns an
Err
:Check the status:
It should display the error, and the context:
Please provide the exact testing steps for the reviewer(s) if this PR requires testing.
Changelog
()
orResult
type