Exceptions
Module
PDFHighlights.Internal.Exceptions
— ModuleThis module contains all the exceptions used in the package, as well as the macro(s) that they were created by.
Types
PDFHighlights.Internal.Exceptions.DirectoryDoesNotExist
— TypeDirectoryDoesNotExist <: Exception
Exception thrown when the specified directory doesn't exist.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.DoesNotExist
— TypeDoesNotExist <: Exception
Exception thrown when the specified file or directory doesn't exist.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.FileDoesNotExist
— TypeFileDoesNotExist <: Exception
Exception thrown when the specified file doesn't exist.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.IncorrectHeader
— TypeIncorrectHeader <: Exception
Exception thrown when the specified file has an incorrect header.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.IntegrityCheckFailed
— TypeIntegrityCheckFailed <: Exception
An exception thrown when another exception was thrown while checking the integrity of the table.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.LastElementIsNotAnInteger
— TypeLastElementIsNotAnInteger <: Exception
Exception thrown when the last element in the line is not an integer.
Fields
file::String
: absolute or relative path to a file that is associated with the exceptionline::Int
: line number of the specified file to which this exception is associated
See also: @exception_with_line
PDFHighlights.Internal.Exceptions.NotCSV
— TypeNotCSV <: Exception
Exception thrown when the specified path does not end in .csv
.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.NotCSVorDir
— TypeNotCSVorDir <: Exception
An exception thrown when the specified path does not end in .csv
ans is not a directory.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.NotCSVorPDForDir
— TypeNotCSVorPDForDir <: Exception
An exception thrown when the specified path does not end in .csv
or .pdf
and is not a directory.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
PDFHighlights.Internal.Exceptions.NotFiveColumns
— TypeNotFiveColumns <: Exception
Exception thrown when the row does not represent elements for 5 columns.
Fields
file::String
: absolute or relative path to a file that is associated with the exceptionline::Int
: line number of the specified file to which this exception is associated
See also: @exception_with_line
PDFHighlights.Internal.Exceptions.NotPDF
— TypeNotPDF <: Exception
Exception thrown when the specified path does not end in .pdf
.
Fields
file::String
: absolute or relative path to a file that is associated with the exception
See also: @exception_with_file
Macros
PDFHighlights.Internal.Exceptions.@docstring
— Macro@docstring(macro_name::Symbol) -> Expr
Redefine the docstring
variable in the innermost macro.
Arguments
macro_name::Symbol
: name of the macro that generated the exception
Returns
Expr
:docstring
redefinition
Example
using PDFHighlights
using SyntaxTree
macro_name = QuoteNode(:name)
@macroexpand(PDFHighlights.Internal.Exceptions.@docstring(name)) |> linefilter! ==
quote
macro_name = $(macro_name)
docstring = Meta.quot(
"""
$(exception_name) <: Exception
$(docstring)
$(fields)
See also: [`@$(macro_name)`](@ref)
"""
)
end |> linefilter!
PDFHighlights.Internal.Exceptions.@exception_with_file
— Macro@exception_with_file(
exception_name::Symbol,
docstring::Union{Expr, String},
error_message_bits::Tuple{Vararg{Union{Expr, String}}},
) -> Expr
Create an exception with one field: a path to the file.
Arguments
exception_name::Symbol
: name of the exceptiondocstring::Union{Expr, String}
: documentation stringerror_message_bits::Tuple{Vararg{Union{Expr, String}}}
: strings and expressions which will be interpolated in theshowerror
output
Returns
Expr
: an exception definition (struct +showerror
overload)
PDFHighlights.Internal.Exceptions.@exception_with_line
— Macro@exception_with_line(
exception_name::Symbol,
docstring::Union{Expr, String},
error_message_bits::Tuple{Vararg{Union{Expr, String}}},
) -> Expr
Create an exception with two fields: a path to the file and a line number.
Arguments
exception_name::Symbol
: name of the exceptiondocstring::Union{Expr, String}
: documentation stringerror_message_bits::Tuple{Vararg{Union{Expr, String}}}
: strings and expressions which will be interpolated in theshowerror
output
Returns
Expr
: an exception definition (struct +showerror
overload)
PDFHighlights.Internal.Exceptions.@exception_without_fields
— Macro@exception_without_fields(
exception_name::Symbol,
docstring::Union{Expr, String},
error_message_bits::Tuple{Vararg{Union{Expr, String}}},
) -> Expr
Create an exception with no fields.
Arguments
exception_name::Symbol
: name of the exceptiondocstring::Union{Expr, String}
: documentation stringerror_message_bits::Tuple{Vararg{Union{Expr, String}}}
: strings and expressions which will be interpolated in theshowerror
output
Returns
Expr
: an exception definition (struct +showerror
overload)
PDFHighlights.Internal.Exceptions.@fields
— Macro@fields(strings::String...) -> Expr
Define the fields
variable in the innermost macro. This variable is a string that describes type fields.
Arguments
strings::Tuple{Vararg{String}}
: strings to store in thefields
variable
Returns
Expr
:fields
definition
Example
using PDFHighlights
using SyntaxTree
strings = ("`Cloverfield`: there's no place like home",)
@macroexpand(
PDFHighlights.Internal.Exceptions.@fields(
"`Cloverfield`: there's no place like home"
)
) |> linefilter! == quote
strings = $(strings) |> collect
strings = join(["- " * string for string in strings], '\n')
fields = """
# Fields\n
$(strings)
"""
end |> linefilter!