Io error handling examples?

Hi there
just had an event that highlit how being lazy will get you every time. I have working code BUT no real error handling in the IO component. I was wondering if there is a example or example(s) anywhere which show the julia canonical way to handle io events. I don’t want to reinvent the wheel if there is a Pkg or a example that I can work with.

In my case I had a problem which got resolved BUT because I was lazy the code just crashed. I know about try/catch and I have added logging to my code.

ERROR: [ Info: reader exiting
LoadError: IOError: write: broken pipe (EPIPE)
 [1] uv_write(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)
   @ Base ./stream.jl:1064
 [2] unsafe_write(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)

@bkamins to the rescue once again! THE cookbook on error handling lashings of excellent examples for everything in here. Can’t understand why I didn’t think about it before. AH laziness and stupidity…
have an EXCELLENT holidays all.

1 Like