-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Exception handling during storing a value #221
Comments
The
This |
Hey, thanks for your response. I believe it's should be always up to the application developer (no the library developer) to decide, which exceptions should be considered as "fatal" and which exceptions should stop the application immediately. Our application ("smart contracts execution node") evaluates states of the smart contracts (which are stored and loaded from the Arweave blockchain). Each smart contract is a javascript or wasm code. This works really nice, but after evaluating the state - we're storing it in the node's cache - which is using the I believe that the issue with handling the exception should be noted in the docs... Is there any timeline to moving to a fully promise-based implementation? |
None at this time. There might be something more specific going on here. I haven't tested it, but a workaround could be explicitly opening the db before you use it: await db.open()
await db.put(..) This ensures the put operation isn't deferred until the db has opened itself, which means the operation (including encoding of the value) will happen inside your |
Thanks! This workaround fixes my issue. Appreciate your time and help! |
In case of an error is thrown during saving/putting a value, e.g.
the error is not being catched by the surrounding try-catch in the above code - but somehow propagated to the "top-level" - and as a result causes the node process to exit (
error Command failed with exit code 1.
), e.g.:Such error can be only catched by:
but it's not an option in this case, as it completely breaks our node application execution.
Why does level behaves this way? is it by design?
The current behaviour makes it unusable in a server-side, node.js applications.
The text was updated successfully, but these errors were encountered: