LoadError

LoadError(file::AbstractString, line::Int, error)

An error occurred while includeing, requireing, or using a file. The error specifics should be available in the .error field.

Examples

Base.LoadError(file::AbstractString, line::Int, error)

An error occurred while includeing, requireing, or using a file. The error specifics can be accessed through the .error field.

Examples:

  1. Handle a LoadError:

    julia> try
              include("nonexistent_file.jl")
          catch err
              throw(LoadError("nonexistent_file.jl", 1, err))
          end

    This example demonstrates how to handle a LoadError by throwing a new LoadError with the file name, line number, and the original error.

  2. Access the error details:
    julia> try
              include("file_with_error.jl")
          catch err
              le = LoadError("file_with_error.jl", 3, err)
              println("Error in file: ", le.file)
              println("Line number: ", le.line)
              println("Error details: ", le.error)
          end

    In this example, we catch an error that occurred while including a file and create a LoadError object. We can then access the details of the error through the .file, .line, and .error fields.

Remember to always handle errors appropriately and provide meaningful information when using LoadError.

See Also

ArgumentError, AssertionError, BoundsError, DivideError, DomainError, EOFError, error, ErrorException, InexactError, InitError, KeyError, LoadError, MethodError, OutOfMemoryError, OverflowError, ParseError, ReadOnlyMemoryError, showerror, StackOverflowError, SystemError, TypeError, UndefRefError, UndefVarError,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: