Skip to content
Snippets Groups Projects

ENH: Add minimal functionality

Merged Florian Spreckelsen requested to merge f-minimal into dev
7 unresolved threads
2 files
+ 50
41
Compare changes
  • Side-by-side
  • Inline

Files

+ 40
6
@@ -28,6 +28,44 @@ Chose the name of the library according to the OS you're running.
"""
library_name = (@static Sys.iswindows() ? "ccaosdb" : "libccaosdb")
module Exceptions
export evaluate_return_code, CaosDBException
using CaosDB
"""
A generic exception that will be raised in case of non-zero return
values of the calls to libccaosdb. May carry a message string and a
code.
"""
struct CaosDBException <: Exception
msg::String
code::Cint
end
Base.showerror(io::IO, e::CaosDBException) = print(io, "CaosDBException: ", e.msg)
"""
function evaluate_return_code(code::Cint)
Evaluate the return code of a libccaosdb ccall and raise a
`CaosDBException` in case of a non-zero return code.
"""
function evaluate_return_code(code::Cint)
if code != 0
msg = ccall(
(:caosdb_get_status_description, CaosDB.library_name),
Cstring,
(Cint,),
code
)
throw(CaosDBException(unsafe_string(msg), code))
end
end
end # Exceptions
module Info
"""
@@ -136,12 +174,8 @@ function create_plain_password_authenticator(
password,
)
if err_code != 0
@error "Creating authenticator failed with code $err_code"
end
CaosDB.Excepions.evaluate_return_code(err_code)
return auth
end
Loading