Errors
Core.ArgumentError — Type
ArgumentError(msg)The arguments passed to a function are invalid. msg is a descriptive error message.
Core.AssertionError — Type
AssertionError([msg])The asserted condition did not evaluate to true. Optional argument msg is a descriptive error string.
Examples
julia> @assert false "this is not true"
ERROR: AssertionError: this is not trueAssertionError is usually thrown from @assert.
Core.BoundsError — Type
BoundsError([a],[i])An indexing operation into an array, a, tried to access an out-of-bounds element at index i.
Examples
julia> A = fill(1.0, 7);
julia> A[8]
ERROR: BoundsError: attempt to access 7-element Vector{Float64} at index [8]
julia> B = fill(1.0, (2,3));
julia> B[2, 4]
ERROR: BoundsError: attempt to access 2×3 Matrix{Float64} at index [2, 4]
julia> B[9]
ERROR: BoundsError: attempt to access 2×3 Matrix{Float64} at index [9]
Core.DivideError — Type
DivideError()Integer division was attempted with a denominator value of 0.
Examples
julia> 2/0
Inf
julia> div(2, 0)
ERROR: DivideError: integer division error
Stacktrace:
[...]Core.DomainError — Type
DomainError(val)
DomainError(val, msg)The argument val to a function or constructor is outside the valid domain.
Examples
julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
[...]Core.ErrorException — Type
ErrorException(msg)Generic error type. The error message, in the .msg field, may provide more specific details.
Examples
julia> ex = ErrorException("I've done a bad thing");
julia> ex.msg
"I've done a bad thing"Core.InexactError — Type
InexactError(name::Symbol, T, val)Cannot exactly convert val to type T in a method of function name.
Examples
julia> convert(Float64, 1+2im)
ERROR: InexactError: Float64(1 + 2im)
Stacktrace:
[...]Core.InterruptException — Type
InterruptException()The process was stopped by a terminal interrupt (CTRL+C).
Note that, in Julia script started without -i (interactive) option, InterruptException is not thrown by default. Calling Base.exit_on_sigint(false) in the script can recover the behavior of the REPL. Alternatively, a Julia script can be started with
julia -e "include(popfirst!(ARGS))" script.jlto let InterruptException be thrown by CTRL+C during the execution.
Core.MethodError — Type
MethodError(f, args)A method with the required type signature does not exist in the given generic function. Alternatively, there is no unique most-specific method.
Core.OutOfMemoryError — Type
OutOfMemoryError()An operation allocated too much memory for either the system or the garbage collector to handle properly.
Core.OverflowError — Type
OverflowError(msg)The result of an expression is too large for the specified type and will cause a wraparound.
Core.ReadOnlyMemoryError — Type
ReadOnlyMemoryError()An operation tried to write to memory that is read-only.
Core.StackOverflowError — Type
StackOverflowError()The function call grew beyond the size of the call stack. This usually happens when a call recurses infinitely.
Core.TypeError — Type
TypeError(func::Symbol, context::AbstractString, expected::Type, got)A type assertion failure, or calling an intrinsic function with an incorrect argument type.
Core.UndefKeywordError — Type
UndefKeywordError(var::Symbol)The required keyword argument var was not assigned in a function call.
Examples
julia> function my_func(;my_arg)
return my_arg + 1
end
my_func (generic function with 1 method)
julia> my_func()
ERROR: UndefKeywordError: keyword argument `my_arg` not assigned
Stacktrace:
[1] my_func() at ./REPL[1]:2
[2] top-level scope at REPL[2]:1Core.UndefRefError — Type
UndefRefError()The item or field is not defined for the given object.
Examples
julia> struct MyType
a::Vector{Int}
MyType() = new()
end
julia> A = MyType()
MyType(#undef)
julia> A.a
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[...]Core.UndefVarError — Type
UndefVarError(var::Symbol, [scope])A symbol in the current scope is not defined.
Examples
julia> a
ERROR: UndefVarError: `a` not defined in `Main`
julia> a = 1;
julia> a
1Base.CompositeException — Type
CompositeExceptionWrap a Vector of exceptions thrown by a Task (e.g. generated from a remote worker over a channel or an asynchronously executing local I/O write or a remote worker under pmap) with information about the series of exceptions. For example, if a group of workers are executing several tasks, and multiple workers fail, the resulting CompositeException will contain a "bundle" of information from each worker indicating where and why the exception(s) occurred.
Base.DimensionMismatch — Type
DimensionMismatch([msg])The objects called do not have matching dimensionality. Optional argument msg is a descriptive error string.
Base.EOFError — Type
EOFError()No more data was available to read from a file or stream.
Base.KeyError — Type
KeyError(key)An indexing operation into an AbstractDict (Dict) or Set like object tried to access or delete a non-existent element.
Base.MissingException — Type
MissingException(msg)Exception thrown when a missing value is encountered in a situation where it is not supported. The error message, in the msg field may provide more specific details.
Base.ProcessFailedException — Type
ProcessFailedExceptionIndicates problematic exit status of a process. When running commands or pipelines, this is thrown to indicate a nonzero exit code was returned (i.e. that the invoked process failed).
Base.StringIndexError — Type
StringIndexError(str, i)An error occurred when trying to access str at index i that is not valid.
Base.SystemError — Type
SystemError(prefix::AbstractString, [errno::Int32])A system call failed with an error code (in the errno global variable).
Base.TaskFailedException — Type
TaskFailedExceptionThis exception is thrown by a wait(t) call when task t fails. TaskFailedException wraps the failed task t.