diff --git a/base/io.jl b/base/io.jl index 647406a437b2f..69972249be02f 100644 --- a/base/io.jl +++ b/base/io.jl @@ -20,7 +20,7 @@ struct SystemError <: Exception extrainfo SystemError(p::AbstractString, e::Integer, extrainfo) = new(p, e, extrainfo) SystemError(p::AbstractString, e::Integer) = new(p, e, nothing) - SystemError(p::AbstractString) = new(p, Libc.errno()) + SystemError(p::AbstractString) = new(p, Libc.errno(), nothing) end lock(::IO) = nothing diff --git a/test/error.jl b/test/error.jl index 38ea378664241..e9d011e382a61 100644 --- a/test/error.jl +++ b/test/error.jl @@ -81,3 +81,8 @@ end # non-Functions @test retry(Float64)(1) === 1.0 end + +@testset "SystemError initialization" begin + e = SystemError("fail") + @test e.extrainfo === nothing +end