|
|
|
@ -20,16 +20,19 @@ function Base.showerror(io::IO, err::ArgumentError) |
|
|
|
print(io, "Prometheus.", nameof(typeof(err)), ": ", err.msg) |
|
|
|
print(io, "Prometheus.", nameof(typeof(err)), ": ", err.msg) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
struct AssertionError <: PrometheusException end |
|
|
|
struct AssertionError <: PrometheusException |
|
|
|
|
|
|
|
msg::String |
|
|
|
|
|
|
|
end |
|
|
|
macro assert(cond) |
|
|
|
macro assert(cond) |
|
|
|
return :($(esc(cond)) || throw(AssertionError())) |
|
|
|
msg = string(cond) |
|
|
|
|
|
|
|
return :($(esc(cond)) || throw(AssertionError($msg))) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function Base.showerror(io::IO, ::AssertionError) |
|
|
|
function Base.showerror(io::IO, err::AssertionError) |
|
|
|
print( |
|
|
|
print( |
|
|
|
io, |
|
|
|
io, |
|
|
|
"Prometheus.AssertionError: this is unexpected. Please file an issue at " * |
|
|
|
"Prometheus.AssertionError: `", err.msg, "`. This is unexpected, please file an " * |
|
|
|
"https://github.com/fredrikekre/Prometheus.jl/issues/new.", |
|
|
|
"issue at https://github.com/fredrikekre/Prometheus.jl/issues/new.", |
|
|
|
) |
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|