From 5ef97a84fe10d423bef7f51dd50607e4a42d8e45 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Fri, 13 Aug 2021 13:32:38 +0200 Subject: [PATCH] ENH: Add Exception type for client exceptions --- src/CaosDB.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/CaosDB.jl b/src/CaosDB.jl index 92ba077..8f71694 100644 --- a/src/CaosDB.jl +++ b/src/CaosDB.jl @@ -56,6 +56,22 @@ struct GenericCaosDBException <: CaosDBException code::Cint end +""" +Something went wrong on the client-side or the user is attempting to +conduct an invalid operation. +""" +struct ClientException <: CaosDBException + msg::String + code::Cint + + function ClientException(message::AbstractString) + client_error_code = + ccall((:caosdb_status_code_OTHER_CLIENT_ERROR, CaosDB.library_name), Cint, ()) + new(message, client_error_code) + end +end + + Base.showerror(io::IO, e::CaosDBException) = print(io, "CaosDBException: ", e.msg, " (Status code ", e.code, ")") -- GitLab