Oddbean new post about | logout
 @b722fd86 it's a limitation of the async model. 
 @b722fd86 you do have some options, though, which you might employ in a larger async project to centralize error handling better 
 @822a3c32 for someone that doesn't know the hare syntax or idioms, it's not super obvious at all that any of those functions are async. (Maybe the yield and the funny for would give me pause, but overall I'd have no clue) 
 @b722fd86 it's not first-class language-level async like you see in e.g. javascript or python. It's async because it's how hare-ev works. Think libuv in C. 
 @b722fd86 basically, in Hare you can pass errors up the call stack, but at some point a frame has to handle them. You can have multiple error handling sites -- a server for instance would probably handle server-level errors differently from client errors, having error handling at the top for server errors (likely fatal) and somewhere in the middle for clients (likely disconnecting the client).

Errors are also just values so you can pass them to shared error handling functions for easier use. 
 @b722fd86 the reason you cannot pass errors up through async function handlers is that each callback is a terminal error site -- if you passed it back up, you'd have to exit the event loop entirely to handle it. So you gotta handle it there. But you can just stick the error in a value and pass it to some shared error handling code that does the meaningful for your use-case