Skip to content
Snippets Groups Projects

ENH: Add minimal functionality

Merged Florian Spreckelsen requested to merge f-minimal into dev
7 unresolved threads
3 files
+ 49
10
Compare changes
  • Side-by-side
  • Inline

Files

+ 21
4
@@ -31,8 +31,9 @@ library_name = (@static Sys.iswindows() ? "ccaosdb" : "libccaosdb")
module Exceptions
export evaluate_return_code, CaosDBException, GenericCaosDBException
export evaluate_return_code, CaosDBException, GenericCaosDBException, CaosDBMessage
using Logging
using CaosDB
"""
@@ -50,7 +51,19 @@ struct GenericCaosDBException <: CaosDBException
code::Cint
end
Base.showerror(io::IO, e::CaosDBException) = print(io, "CaosDBException: ", e.msg)
Base.showerror(io::IO, e::CaosDBException) =
print(io, "CaosDBException: ", e.msg, " (Status code ", e.code, ")")
"""
Struct containing Messages and codes for status codes<0 that do not
correspond to errors or success.
"""
struct CaosDBMessage
msg::String
code::Cint
end
Base.show(io::IO, m::CaosDBMessage) = print(io, m.msg, " (Status code ", m.code, ")")
"""
function evaluate_return_code(code::Cint)
@@ -66,7 +79,11 @@ function evaluate_return_code(code::Cint)
(Cint,),
code,
)
throw(GenericCaosDBException(unsafe_string(msg), code))
if code > 0
throw(GenericCaosDBException(unsafe_string(msg), code))
else
@info CaosDBMessage(unsafe_string(msg), code)
end
end
end
@@ -180,7 +197,7 @@ function create_plain_password_authenticator(
password,
)
CaosDB.Excepions.evaluate_return_code(err_code)
CaosDB.Exceptions.evaluate_return_code(err_code)
return auth
Loading