For modules that expose async public APIs, I often want to assert but want the assertion error returned via the callback. I do this frequently to avoid reimplementing non-throwing validation at the caller (i.e., a server handler), and to avoid usage of try/catch at the caller. I'm thinking a wrapper that takes a function of assertions and a callback:
I realize this somewhat conflicts with the spirit and ethos of assertions. It's easy enough to wrap in userland, but figured it wouldn't hurt to ask if this seemed like something useful. Would be happy to file a PR if so - otherwise, feel free to close.
For modules that expose async public APIs, I often want to assert but want the assertion error returned via the callback. I do this frequently to avoid reimplementing non-throwing validation at the caller (i.e., a server handler), and to avoid usage of try/catch at the caller. I'm thinking a wrapper that takes a function of assertions and a callback:
I realize this somewhat conflicts with the spirit and ethos of assertions. It's easy enough to wrap in userland, but figured it wouldn't hurt to ask if this seemed like something useful. Would be happy to file a PR if so - otherwise, feel free to close.