Exception
Index
CTBase.AmbiguousDescriptionCTBase.CTExceptionCTBase.ExtensionErrorCTBase.IncorrectArgumentCTBase.IncorrectMethodCTBase.IncorrectOutputCTBase.NotImplementedCTBase.ParsingErrorCTBase.UnauthorizedCallBase.showerrorBase.showerrorBase.showerrorBase.showerrorBase.showerrorBase.showerrorBase.showerrorBase.showerror
In the examples in the documentation below, the methods are not prefixed by the module name even if they are private.
julia> using CTBase
julia> x = 1
julia> private_fun(x) # throw an errormust be replaced by
julia> using CTBase
julia> x = 1
julia> CTBase.private_fun(x)However, if the method is reexported by another package, then, there is no need of prefixing.
julia> module OptimalControl
import CTBase: private_fun
export private_fun
end
julia> using OptimalControl
julia> x = 1
julia> private_fun(x)Documentation
CTBase.AmbiguousDescription — Typestruct AmbiguousDescription <: CTBase.CTExceptionException thrown when a description is ambiguous or does not match any known descriptions.
Fields
var::Tuple{Vararg{Symbol}}: The ambiguous or incorrect description tuple that caused the error.
Example
julia> complete(:f; descriptions=((:a, :b), (:a, :b, :c)))
ERROR: AmbiguousDescription: the description (:f,) is ambiguous / incorrectThis error is useful to signal when a user provides a description that cannot be matched to any known valid descriptions.
CTBase.CTException — Typeabstract type CTException <: ExceptionAbstract supertype for all custom exceptions in this module.
Use this as the common ancestor for all domain-specific errors to allow catching all exceptions of this family via catch e::CTException.
No fields.
Example
julia> try
throw(IncorrectArgument("invalid input"))
catch e::CTException
println("Caught a domain-specific exception: ", e)
end
Caught a domain-specific exception: IncorrectArgument: invalid inputCTBase.ExtensionError — Typestruct ExtensionError <: CTBase.CTExceptionException thrown when an extension or optional dependency is not loaded but a function requiring it is called.
Fields
weakdeps::Tuple{Vararg{Symbol}}: The tuple of symbols representing the missing dependencies.
Constructor
Throws UnauthorizedCall if no weak dependencies are provided.
Example
julia> throw(ExtensionError(:MyExtension))
ERROR: ExtensionError. Please make: julia> using MyExtensionCTBase.IncorrectArgument — Typestruct IncorrectArgument <: CTBase.CTExceptionException thrown when an argument passed to a function or constructor is inconsistent, invalid, or does not satisfy preconditions.
Fields
var::String: A descriptive message explaining the nature of the incorrect argument.
Example
julia> throw(IncorrectArgument("the argument must be a non-empty tuple"))
ERROR: IncorrectArgument: the argument must be a non-empty tupleCTBase.IncorrectMethod — Typestruct IncorrectMethod <: CTBase.CTExceptionException thrown when a specified method name or function symbol does not exist.
Fields
var::Symbol: The method or function symbol that was expected but not found.
Example
julia> throw(IncorrectMethod(:nonexistent_func))
ERROR: IncorrectMethod: nonexistent_func is not an existing methodCTBase.IncorrectOutput — Typestruct IncorrectOutput <: CTBase.CTExceptionException thrown when the output produced by a function is incorrect or inconsistent with expected results.
Fields
var::String: A descriptive message explaining the incorrect output.
Example
julia> throw(IncorrectOutput("the function returned NaN"))
ERROR: IncorrectOutput: the function returned NaNCTBase.NotImplemented — Typestruct NotImplemented <: CTBase.CTExceptionException thrown when a method or function has not been implemented yet.
Fields
var::String: A message indicating what functionality is not yet implemented.
Example
julia> throw(NotImplemented("feature X is not implemented"))
ERROR: NotImplemented: feature X is not implementedCTBase.ParsingError — Typestruct ParsingError <: CTBase.CTExceptionException thrown during parsing when a syntax error or invalid structure is detected.
Fields
var::String: A message describing the parsing error.
Example
julia> throw(ParsingError("unexpected token"))
ERROR: ParsingError: unexpected tokenCTBase.UnauthorizedCall — Typestruct UnauthorizedCall <: CTBase.CTExceptionException thrown when a function call is not authorized in the current context or with the given arguments.
Fields
var::String: A message explaining why the call is unauthorized.
Example
julia> throw(UnauthorizedCall("user does not have permission"))
ERROR: UnauthorizedCall: user does not have permissionBase.showerror — Methodshowerror(io::IO, e::CTBase.AmbiguousDescription)
Customizes the printed message of the exception.
Example
julia> throw(AmbiguousDescription((:x, :y)))
ERROR: AmbiguousDescription: the description (:x, :y) is ambiguous / incorrectBase.showerror — Methodshowerror(io::IO, e::CTBase.ExtensionError)
Customizes the printed message of the exception, prompting the user to load the required extensions.
Example
julia> e = ExtensionError(:MyExtension, :AnotherDep)
julia> showerror(stdout, e)
ERROR: ExtensionError. Please make: julia> using MyExtension, AnotherDepBase.showerror — Methodshowerror(io::IO, e::CTBase.IncorrectArgument)
Customizes the printed message of the exception.
Base.showerror — Methodshowerror(io::IO, e::CTBase.IncorrectMethod)
Customizes the printed message of the exception.
Base.showerror — Methodshowerror(io::IO, e::CTBase.IncorrectOutput)
Customizes the printed message of the exception.
Base.showerror — Methodshowerror(io::IO, e::CTBase.NotImplemented)
Customizes the printed message of the exception.
Base.showerror — Methodshowerror(io::IO, e::CTBase.ParsingError)
Customizes the printed message of the exception.
Base.showerror — Methodshowerror(io::IO, e::CTBase.UnauthorizedCall)
Customizes the printed message of the exception.