error: add error_get_class()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
0f32cf6abc
commit
ea25fbca88
5
error.c
5
error.c
@ -64,6 +64,11 @@ bool error_is_set(Error **errp)
|
|||||||
return (errp && *errp);
|
return (errp && *errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorClass error_get_class(const Error *err)
|
||||||
|
{
|
||||||
|
return err->err_class;
|
||||||
|
}
|
||||||
|
|
||||||
const char *error_get_pretty(Error *err)
|
const char *error_get_pretty(Error *err)
|
||||||
{
|
{
|
||||||
return err->msg;
|
return err->msg;
|
||||||
|
5
error.h
5
error.h
@ -35,6 +35,11 @@ void error_set(Error **err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_
|
|||||||
*/
|
*/
|
||||||
bool error_is_set(Error **err);
|
bool error_is_set(Error **err);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the error class of an error object.
|
||||||
|
*/
|
||||||
|
ErrorClass error_get_class(const Error *err);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an exact copy of the error passed as an argument.
|
* Returns an exact copy of the error passed as an argument.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user