A code formatter for Julia with rules set in stone.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
933 B

# SPDX-License-Identifier: MIT
##############
# Debug info #
##############
abstract type RunicException <: Exception end
struct AssertionError <: RunicException
msg::String
end
# Thrown from internal code when invalid CLI arguments can not be validated directly in
# `Runic.main`: `throw(MainError("message"))` from internal code is like calling
# `panic("message")` in `Runic.main`.
struct MainError <: RunicException
msg::String
end
function Base.showerror(io::IO, err::AssertionError)
print(
io,
"Runic.AssertionError: ", err.msg, ". This is unexpected, " *
"please file an issue with a reproducible example at " *
"https://github.com/fredrikekre/Runic.jl/issues/new."
)
return
end
macro assert(expr)
msg = string(expr)
return :($(esc(expr)) || throw(AssertionError($msg)))
end
@noinline unreachable() = throw(AssertionError("unreachable code reached"))