@@ -75,9 +75,9 @@ function serve(server::Sockets.TCPServer)
7575 msg_id = read (io, MsgID)
7676
7777 msg_data, success = try
78- deserialize (io), true
78+ ( deserialize (io), true )
7979 catch err
80- err, false
80+ ( format_error ( err, catch_backtrace ()), false )
8181 finally
8282 _discard_until_boundary (io)
8383 end
@@ -116,16 +116,14 @@ function handle(::Val{MsgType.from_host_call_with_response}, socket, msg, msg_id
116116 f, args, kwargs, respond_with_nothing = msg
117117
118118 @async begin
119- success, result = try
119+ result, success = try
120120 result = f (args... ; kwargs... )
121121
122122 # @debug("WORKER: Evaluated result", result)
123- (true , respond_with_nothing ? nothing : result)
124- catch e
123+ (respond_with_nothing ? nothing : result, true )
124+ catch err
125125 # @debug("WORKER: Got exception!", e)
126- (false , sprint () do io
127- Base. invokelatest (showerror, io, e, catch_backtrace ())
128- end )
126+ (format_error (err, catch_backtrace ()), false )
129127 end
130128
131129 _serialize_msg (
@@ -158,9 +156,12 @@ function handle(::Val{MsgType.special_serialization_failure}, socket, msg, msg_i
158156 )
159157end
160158
159+ format_error (err, bt) = sprint () do io
160+ Base. invokelatest (showerror, io, err, bt)
161+ end
162+
161163const _channel_cache = Dict {UInt64, AbstractChannel} ()
162164
163165if abspath (PROGRAM_FILE ) == @__FILE__
164166 main ()
165167end
166-
0 commit comments