Skip to content

Commit

Permalink
Fixes for 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Aug 7, 2018
1 parent 8cac431 commit cd9f60b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Servers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function listen(f::Function,
@async try
handle_connection(f, io; kw...)
catch e
@error "Error: $io" e catch_stacktrace()
@error "Error: $io" exception=(e, stacktrace(catch_backtrace()))
finally
close(io)
@info "Closed: $io"
Expand Down Expand Up @@ -478,7 +478,7 @@ function handle_transaction(f::Function, t::Transaction;
if isioerror(e)
@warn e
else
@error e catch_stacktrace()
@error exception=(e, stacktrace(catch_backtrace()))
end
close(t)
end
Expand All @@ -502,7 +502,7 @@ function handle_stream(f::Function, http::Stream)
end
catch e
if isopen(http) && !iswritable(http)
@error e catch_stacktrace()
@error exception=(e, stacktrace(catch_backtrace()))
http.message.response.status = 500
startwrite(http)
write(http, sprint(showerror, e))
Expand Down
10 changes: 5 additions & 5 deletions test/async.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ conf = [:reuse_limit => 90,
#println("S3 put file$i")
@assert strip(HTTP.header(r, "ETag"), '"') == md5
catch e
dump_async_exception(e, catch_stacktrace())
dump_async_exception(e, stacktrace(catch_backtrace()))
rethrow(e)
end
end
Expand Down Expand Up @@ -164,7 +164,7 @@ get_data_sums = Dict()
md5 = bytes2hex(digest(MD_MD5, bytes))
get_data_sums[i] = (md5, strip(HTTP.header(r, "ETag"), '"'))
catch e
dump_async_exception(e, catch_stacktrace())
dump_async_exception(e, stacktrace(catch_backtrace()))
rethrow(e)
end
end
Expand Down Expand Up @@ -206,7 +206,7 @@ println("running async $count, 1:$num, $config, $http A")
r = JSON.parse(String(r.body))
push!(result, r["headers"]["I"] => string(i))
catch e
dump_async_exception(e, catch_stacktrace())
dump_async_exception(e, stacktrace(catch_backtrace()))
rethrow(e)
end
end
Expand All @@ -231,7 +231,7 @@ println("running async $count, 1:$num, $config, $http B")
r = split(strip(r), "\n")
push!(result, length(r) => i)
catch e
dump_async_exception(e, catch_stacktrace())
dump_async_exception(e, stacktrace(catch_backtrace()))
rethrow(e)
end
end
Expand Down Expand Up @@ -322,7 +322,7 @@ println("running async $count, 1:$num, $config, $http C")
push!(result, length(l) => n)
catch e
push!(result, e => n)
dump_async_exception(e, catch_stacktrace())
dump_async_exception(e, stacktrace(catch_backtrace()))
rethrow(e)
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/loopback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function on_body(f, lb)
@async try
f(req)
catch e
println("⚠️ on_body exception: $(sprint(showerror, e))\n$(catch_stacktrace())")
println("⚠️ on_body exception: $(sprint(showerror, e))\n$(stacktrace(catch_backtrace()))")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ put!(server.in, HTTP.Servers.KILL)

# keep-alive vs. close: issue #81
port += 1
tsk = @async HTTP.Servers.serve(HTTP.Servers.Server((req) -> (req.response.body = "Hello\n"; req.response), stdout), "127.0.0.1", port)
tsk = @async HTTP.Servers.serve(HTTP.Servers.Server((req) -> HTTP.Response("Hello\n"), stdout), "127.0.0.1", port)
sleep(2.0)
r = HTTP.request("GET", "http://127.0.0.1:$port/", ["Host"=>"127.0.0.1:$port"]; http_version=v"1.0")
@test r.status == 200
Expand Down

0 comments on commit cd9f60b

Please sign in to comment.