by thinkharderdev · 6y ago · 0 comments
> Just write the happy / known-to-the-programmer path and let what you don't know about bubble up to main() or the top of your event loop.
I believe that is the point, an IO exception o some sort is a known exception case so the return type of the function should express that. This function can return either the contents of a file or an IOError if the file cannot be read for some reason. The caller can then decide whether they want to try and handle the exception case or ignore it and let it bubble up the stack, but the function should clearly express that it is a possible outcome.
No comments yet.