Skip to content

Commit

Permalink
Add WrappedException abstract type
Browse files Browse the repository at this point in the history
Implemented by LoadError and InitError
  • Loading branch information
jdlangs committed Aug 16, 2015
1 parent 5b5ef61 commit 5898d2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 15 additions & 11 deletions base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ type KeyError <: Exception
key
end

type LoadError <: Exception
file::AbstractString
line::Int
error
end

type InitError <: Exception
mod::Symbol
error
end

type MethodError <: Exception
f
args
Expand All @@ -64,6 +53,21 @@ type AssertionError <: Exception
AssertionError(msg) = new(msg)
end

#Generic wrapping of arbitrary exceptions
#Subtypes should put the exception in an 'error' field
abstract WrappedException <: Exception

type LoadError <: WrappedException
file::AbstractString
line::Int
error
end

type InitError <: WrappedException
mod::Symbol
error
end

ccall(:jl_get_system_hooks, Void, ())


Expand Down
2 changes: 1 addition & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function show(io::IO, ex::PrecompilableError)
end
end
precompilableerror(ex::PrecompilableError, c) = ex.isprecompilable == c
precompilableerror(ex::Union{LoadError,InitError}, c) = precompilableerror(ex.error, c)
precompilableerror(ex::WrappedException, c) = precompilableerror(ex.error, c)
precompilableerror(ex, c) = false

# put at the top of a file to force it to be precompiled (true), or
Expand Down

0 comments on commit 5898d2e

Please sign in to comment.