package obus
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=3bf0aeb00bf90cd4111483b37cefcb39af38ad6db1aeb6949a2fbecc13ff9a90
md5=7dd48f9bde3e069898fa08e9972596b5
doc/obus/OBus_error/index.html
Module OBus_error
D-Bus errors management
This module integrates D-Bus errors into OCaml exceptions, and OCaml exceptions into D-Bus errors.
To do this, an OCaml exception that maps a D-Bus error should be registered with Register.
type name = OBus_name.errorAn error name. For example: "org.foo.bar.Error.Failed"
General exception for D-Bus errors. When the reply to a method call is a D-Bus error that have not been registered, this exception is raised.
Arguments are:
- the D-Bus error name
- the error message
val ocaml : nameThe name of the D-Bus error which is generated for uncaught ocaml exceptions that have not been registered
D-Bus errors creating/casting
val name : exn -> namename exn returns the D-Bus error name under which this exception is registered. If the exception is not registered, then ocaml is returned.
make exn message creates an exception from an error name and an error message. If the name is not registered, then DBus(name, message) is returned.
cast exn returns the D-Bus name and message of the given exception. If the exception is not registered, (ocaml, Printexc.to_string exn) is returned.
Errors registration
module type Error = sig ... endSignature for D-Bus error
Well-known dbus exception
The following errors can be raised by any service. You can also raise them in a method your service implement.
Note that the error message will normally be shown to the user so they must be explicative.
exception Failed of messageThe org.freedesktop.DBus.Error.Failed error
exception Invalid_args of messageThe org.freedesktop.DBus.Error.InvalidArgs error
exception Unknown_method of messageThe org.freedesktop.DBus.Error.UnknownMethod error
exception Unknown_object of messageThe org.freedesktop.DBus.Error.UnknownObject error
exception Unknown_interface of messageThe org.freedesktop.DBus.Error.UnknownInterface error
exception Unknown_property of messageThe org.freedesktop.DBus.Error.UnknownProperty error
exception Property_read_only of messageThe org.freedesktop.DBus.Error.PropertyReadOnly error
exception No_memory of messageThe org.freedesktop.DBus.Error.NoMemory error
exception No_reply of messageThe org.freedesktop.DBus.Error.NoReply error