Errors

Errors — error definitions and utilities

Synopsis

#define             TLM_ERROR
#define             TLM_GET_ERROR_FOR_ID                (code,
                                                         message,
                                                         ...)
enum                TlmError;
GQuark              tlm_error_quark                     (void);

Description

This file provides Tlm error definitions and utilities. When creating an error, use TLM_ERROR for the error domain and errors from TlmError for the error code.

    GError* err = g_error_new(TLM_ERROR, TLM_ERROR_INVALID_INPUT,
    "Invalid input");

Details

TLM_ERROR

#define TLM_ERROR   (tlm_error_quark())

This macro should be used when creating a GError (for example with g_error_new()).


TLM_GET_ERROR_FOR_ID()

#define             TLM_GET_ERROR_FOR_ID(code, message, args...)

A helper macro that creates a GError with the proper tlm domain

code :

A TlmError specifying the error

message :

Format string for the error message

... :

parameters for the error string

enum TlmError

typedef enum {
    TLM_ERROR_NONE,

    TLM_ERROR_UNKNOWN = 1,
    TLM_ERROR_INTERNAL_SERVER,
    TLM_ERROR_PERMISSION_DENIED,

    TLM_ERROR_INVALID_INPUT = 32,
    TLM_ERROR_SEAT_NOT_FOUND,
    TLM_ERROR_SESSION_CREATION_FAILURE,
    TLM_ERROR_SESSION_ALREADY_EXISTS,
    TLM_ERROR_SESSION_NOT_VALID,
    TLM_ERROR_DBUS_SERVER_START_FAILURE,

    TLM_ERROR_DBUS_REQ_ABORTED = 40,
    TLM_ERROR_DBUS_REQ_NOT_SUPPORTED,
    TLM_ERROR_DBUS_REQ_UNKNOWN,

    TLM_ERROR_LAST_ERR = 400
} TlmError;

This enumeration provides a list of errors

TLM_ERROR_NONE

No error

TLM_ERROR_UNKNOWN

Catch-all for errors not distinguished by another error code

TLM_ERROR_INTERNAL_SERVER

Server internal error

TLM_ERROR_PERMISSION_DENIED

Permission denied

TLM_ERROR_INVALID_INPUT

Invalid input

TLM_ERROR_SEAT_NOT_FOUND

Seat not found

TLM_ERROR_SESSION_CREATION_FAILURE

Session creation failed

TLM_ERROR_SESSION_ALREADY_EXISTS

Session already exists

TLM_ERROR_SESSION_NOT_VALID

session is not valid anymore

TLM_ERROR_DBUS_SERVER_START_FAILURE

dbus-server startup failed

TLM_ERROR_DBUS_REQ_ABORTED

Dbus request aborted

TLM_ERROR_DBUS_REQ_NOT_SUPPORTED

Dbus request not supported

TLM_ERROR_DBUS_REQ_UNKNOWN

Dbus request failed with unknown error

TLM_ERROR_LAST_ERR

Placeholder to rearrange enumeration

tlm_error_quark ()

GQuark              tlm_error_quark                     (void);

Creates and returns a domain for Tlm errors.

Returns :

GQuark for Tlm errors