Allow for graceful failure of Promise.all if one of many queries reverts / errors.#56
Allow for graceful failure of Promise.all if one of many queries reverts / errors.#560xidkfa wants to merge 1 commit intomorpho-org:mainfrom
Conversation
…ully and returns error object BREAKING CHANGE: Wrap no longer throws an error.
|
@Rubilmax Is there a better / different way to do this? I noticed in 4.0.0, you already tried to add graceful failure, but I couldn't figure out how to get away with it when using Promise.all... |
Hi @0xidkfa, thanks for your contribution! Fortunately, this refactoring was performed in the new package We shall decommission this package now that the new one replaced it with many new & useful features |
|
Thanks for this! Is this package deprecated in favor of the Also, when you say promises are not independent in this library, do you mind giving an example of when promises would be dependent on each other? |
Indeed, I'll deprecate this package in favor of
Using this package, if any of the following contract calls revert, all others revert too and you don't get a good explanation of what fails: await Promise.all([
wrappedUni.symbol(),
wrappedUni.unknown().catch(),
]);so you will never successfully get the symbol because the unknown function will always revert (even if you catch it, because this package bundles all promises performed within a 10ms window into a single one, via dataloader) |
feat(ethers.ts): improved wrap function handles query failures gracefully and returns error object
BREAKING CHANGE: Wrap no longer throws an error.
When calling
Promise.all([wrappedUni.symbol(), wrappedUnknown.symbol()]), the current library will throw an error for the entire promise. Instead of throwing an error, I've made a slight modification to return an error object. The response will now come in the following form:Pull-Request Checklist
mainbranchnpm run lintpasses with this changenpm run testpasses with this changeFixes #0000