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
I ran into an error tonight where I was calling proxy.web at the end of an express route handler and because it was asynchronous with no way to confirm success, I had to let it drop through the end of the handler. The problem is that, because it dropped through, when any error happened in the connection, it threw a process-killing error in the global scope, rather than within my defined try/catch block. If the function would in some way indicate success, then I could promisify it and await it, which would allow me to catch the error within my normal flow.
I see three main options:
Just update the function to return a promise instead of using the traditional callback technique
Update the callback signature to make the error optionally null, which would signal that the request was successful
Add an additional callback that is called on success
The first two would be considerably more modern, but of course, would break the current interface, meaning a major version bump. The last one would obviously work without a major bump, but would be more old school.... Let me know if you think there's merit to this.
The text was updated successfully, but these errors were encountered:
Hello! I'm going to be working with the other maintainers to etch out what the next milestone will look like, and I absolutely agree this is most likely a must have. Thanks for your input :)
I ran into an error tonight where I was calling
proxy.web
at the end of an express route handler and because it was asynchronous with no way to confirm success, I had to let it drop through the end of the handler. The problem is that, because it dropped through, when any error happened in the connection, it threw a process-killing error in the global scope, rather than within my defined try/catch block. If the function would in some way indicate success, then I could promisify it andawait
it, which would allow me to catch the error within my normal flow.I see three main options:
The first two would be considerably more modern, but of course, would break the current interface, meaning a major version bump. The last one would obviously work without a major bump, but would be more old school.... Let me know if you think there's merit to this.
The text was updated successfully, but these errors were encountered: