Exception handling.
More...
|
enum | _PedExceptionOption {
PED_EXCEPTION_UNHANDLED =0
, PED_EXCEPTION_FIX =1
, PED_EXCEPTION_YES =2
, PED_EXCEPTION_NO =4
,
PED_EXCEPTION_OK =8
, PED_EXCEPTION_RETRY =16
, PED_EXCEPTION_IGNORE =32
, PED_EXCEPTION_CANCEL =64
,
PED_EXCEPTION_OK_CANCEL = PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_YES_NO = PED_EXCEPTION_YES + PED_EXCEPTION_NO
, PED_EXCEPTION_YES_NO_CANCEL
, PED_EXCEPTION_IGNORE_CANCEL
,
PED_EXCEPTION_RETRY_CANCEL = PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_RETRY_IGNORE_CANCEL
, PED_EXCEPTION_UNHANDLED =0
, PED_EXCEPTION_FIX =1
,
PED_EXCEPTION_YES =2
, PED_EXCEPTION_NO =4
, PED_EXCEPTION_OK =8
, PED_EXCEPTION_RETRY =16
,
PED_EXCEPTION_IGNORE =32
, PED_EXCEPTION_CANCEL =64
, PED_EXCEPTION_OK_CANCEL = PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_YES_NO = PED_EXCEPTION_YES + PED_EXCEPTION_NO
,
PED_EXCEPTION_YES_NO_CANCEL
, PED_EXCEPTION_IGNORE_CANCEL
, PED_EXCEPTION_RETRY_CANCEL = PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_RETRY_IGNORE_CANCEL
} |
| Option for resolving the exception. More...
|
|
enum | _PedExceptionOption {
PED_EXCEPTION_UNHANDLED =0
, PED_EXCEPTION_FIX =1
, PED_EXCEPTION_YES =2
, PED_EXCEPTION_NO =4
,
PED_EXCEPTION_OK =8
, PED_EXCEPTION_RETRY =16
, PED_EXCEPTION_IGNORE =32
, PED_EXCEPTION_CANCEL =64
,
PED_EXCEPTION_OK_CANCEL = PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_YES_NO = PED_EXCEPTION_YES + PED_EXCEPTION_NO
, PED_EXCEPTION_YES_NO_CANCEL
, PED_EXCEPTION_IGNORE_CANCEL
,
PED_EXCEPTION_RETRY_CANCEL = PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_RETRY_IGNORE_CANCEL
, PED_EXCEPTION_UNHANDLED =0
, PED_EXCEPTION_FIX =1
,
PED_EXCEPTION_YES =2
, PED_EXCEPTION_NO =4
, PED_EXCEPTION_OK =8
, PED_EXCEPTION_RETRY =16
,
PED_EXCEPTION_IGNORE =32
, PED_EXCEPTION_CANCEL =64
, PED_EXCEPTION_OK_CANCEL = PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_YES_NO = PED_EXCEPTION_YES + PED_EXCEPTION_NO
,
PED_EXCEPTION_YES_NO_CANCEL
, PED_EXCEPTION_IGNORE_CANCEL
, PED_EXCEPTION_RETRY_CANCEL = PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL
, PED_EXCEPTION_RETRY_IGNORE_CANCEL
} |
| Option for resolving the exception. More...
|
|
enum | _PedExceptionType {
PED_EXCEPTION_INFORMATION =1
, PED_EXCEPTION_WARNING =2
, PED_EXCEPTION_ERROR =3
, PED_EXCEPTION_FATAL =4
,
PED_EXCEPTION_BUG =5
, PED_EXCEPTION_NO_FEATURE =6
, PED_EXCEPTION_INFORMATION =1
, PED_EXCEPTION_WARNING =2
,
PED_EXCEPTION_ERROR =3
, PED_EXCEPTION_FATAL =4
, PED_EXCEPTION_BUG =5
, PED_EXCEPTION_NO_FEATURE =6
} |
| Exception type. More...
|
|
enum | _PedExceptionType {
PED_EXCEPTION_INFORMATION =1
, PED_EXCEPTION_WARNING =2
, PED_EXCEPTION_ERROR =3
, PED_EXCEPTION_FATAL =4
,
PED_EXCEPTION_BUG =5
, PED_EXCEPTION_NO_FEATURE =6
, PED_EXCEPTION_INFORMATION =1
, PED_EXCEPTION_WARNING =2
,
PED_EXCEPTION_ERROR =3
, PED_EXCEPTION_FATAL =4
, PED_EXCEPTION_BUG =5
, PED_EXCEPTION_NO_FEATURE =6
} |
| Exception type. More...
|
|
Exception handling.
There are a few types of exceptions: PED_EXCEPTION_INFORMATION, PED_EXCEPTION_WARNING, PED_EXCEPTION_ERROR, PED_EXCEPTION_FATAL, PED_EXCEPTION_BUG.
They are "thrown" when one of the above events occur while executing a libparted function. For example, if ped_device_open() fails because the device doesn't exist, an exception will be thrown. Exceptions contain text describing what the event was. It will give at least one option for resolving the exception: PED_EXCEPTION_FIX, PED_EXCEPTION_YES, PED_EXCEPTION_NO, PED_EXCEPTION_OK, PED_EXCEPTION_RETRY, PED_EXCEPTION_IGNORE, PED_EXCEPTION_CANCEL. After an exception is thrown, there are two things that can happen:
- an exception handler is called, which selects how the exception should be resolved (usually by asking the user). Also note: an exception handler may choose to return PED_EXCEPTION_UNHANDLED. In this case, a default action will be taken by libparted (respectively the code that threw the exception). In general, a default action will be "safe".
- the exception is not handled, because the caller of the function wants to handle everything itself. In this case, PED_EXCEPTION_UNHANDLED is returned.
#define _ |
( |
|
String | ) |
(String) |
◆ N_
#define N_ |
( |
|
String | ) |
String |
◆ PED_EXCEPTION_OPTION_FIRST [1/2]
◆ PED_EXCEPTION_OPTION_FIRST [2/2]
◆ PED_EXCEPTION_OPTION_LAST [1/2]
◆ PED_EXCEPTION_OPTION_LAST [2/2]
◆ PedException [1/2]
◆ PedException [2/2]
◆ PedExceptionHandler [1/2]
◆ PedExceptionHandler [2/2]
◆ PedExceptionOption [1/2]
◆ PedExceptionOption [2/2]
◆ PedExceptionType [1/2]
◆ PedExceptionType [2/2]
◆ _PedExceptionOption [1/2]
Option for resolving the exception.
Enumerator |
---|
PED_EXCEPTION_UNHANDLED | |
PED_EXCEPTION_FIX | |
PED_EXCEPTION_YES | |
PED_EXCEPTION_NO | |
PED_EXCEPTION_OK | |
PED_EXCEPTION_RETRY | |
PED_EXCEPTION_IGNORE | |
PED_EXCEPTION_CANCEL | |
PED_EXCEPTION_OK_CANCEL | |
PED_EXCEPTION_YES_NO | |
PED_EXCEPTION_YES_NO_CANCEL | |
PED_EXCEPTION_IGNORE_CANCEL | |
PED_EXCEPTION_RETRY_CANCEL | |
PED_EXCEPTION_RETRY_IGNORE_CANCEL | |
PED_EXCEPTION_UNHANDLED | |
PED_EXCEPTION_FIX | |
PED_EXCEPTION_YES | |
PED_EXCEPTION_NO | |
PED_EXCEPTION_OK | |
PED_EXCEPTION_RETRY | |
PED_EXCEPTION_IGNORE | |
PED_EXCEPTION_CANCEL | |
PED_EXCEPTION_OK_CANCEL | |
PED_EXCEPTION_YES_NO | |
PED_EXCEPTION_YES_NO_CANCEL | |
PED_EXCEPTION_IGNORE_CANCEL | |
PED_EXCEPTION_RETRY_CANCEL | |
PED_EXCEPTION_RETRY_IGNORE_CANCEL | |
◆ _PedExceptionOption [2/2]
Option for resolving the exception.
Enumerator |
---|
PED_EXCEPTION_UNHANDLED | |
PED_EXCEPTION_FIX | |
PED_EXCEPTION_YES | |
PED_EXCEPTION_NO | |
PED_EXCEPTION_OK | |
PED_EXCEPTION_RETRY | |
PED_EXCEPTION_IGNORE | |
PED_EXCEPTION_CANCEL | |
PED_EXCEPTION_OK_CANCEL | |
PED_EXCEPTION_YES_NO | |
PED_EXCEPTION_YES_NO_CANCEL | |
PED_EXCEPTION_IGNORE_CANCEL | |
PED_EXCEPTION_RETRY_CANCEL | |
PED_EXCEPTION_RETRY_IGNORE_CANCEL | |
PED_EXCEPTION_UNHANDLED | |
PED_EXCEPTION_FIX | |
PED_EXCEPTION_YES | |
PED_EXCEPTION_NO | |
PED_EXCEPTION_OK | |
PED_EXCEPTION_RETRY | |
PED_EXCEPTION_IGNORE | |
PED_EXCEPTION_CANCEL | |
PED_EXCEPTION_OK_CANCEL | |
PED_EXCEPTION_YES_NO | |
PED_EXCEPTION_YES_NO_CANCEL | |
PED_EXCEPTION_IGNORE_CANCEL | |
PED_EXCEPTION_RETRY_CANCEL | |
PED_EXCEPTION_RETRY_IGNORE_CANCEL | |
◆ _PedExceptionType [1/2]
Exception type.
Enumerator |
---|
PED_EXCEPTION_INFORMATION | |
PED_EXCEPTION_WARNING | |
PED_EXCEPTION_ERROR | |
PED_EXCEPTION_FATAL | |
PED_EXCEPTION_BUG | |
PED_EXCEPTION_NO_FEATURE | |
PED_EXCEPTION_INFORMATION | |
PED_EXCEPTION_WARNING | |
PED_EXCEPTION_ERROR | |
PED_EXCEPTION_FATAL | |
PED_EXCEPTION_BUG | |
PED_EXCEPTION_NO_FEATURE | |
◆ _PedExceptionType [2/2]
Exception type.
Enumerator |
---|
PED_EXCEPTION_INFORMATION | |
PED_EXCEPTION_WARNING | |
PED_EXCEPTION_ERROR | |
PED_EXCEPTION_FATAL | |
PED_EXCEPTION_BUG | |
PED_EXCEPTION_NO_FEATURE | |
PED_EXCEPTION_INFORMATION | |
PED_EXCEPTION_WARNING | |
PED_EXCEPTION_ERROR | |
PED_EXCEPTION_FATAL | |
PED_EXCEPTION_BUG | |
PED_EXCEPTION_NO_FEATURE | |
◆ ped_exception_catch()
void ped_exception_catch |
( |
| ) |
|
Assert that the current exception has been resolved.
◆ ped_exception_default_handler()
◆ ped_exception_fetch_all()
void ped_exception_fetch_all |
( |
| ) |
|
Indicates that exceptions should not go to the exception handler, but passed up to the calling function(s).
All calls to ped_exception_throw() will return PED_EXCEPTION_UNHANDLED.
◆ ped_exception_get_handler()
Get the current exception handler.
◆ ped_exception_get_option_string()
Return a string describing an exception option.
◆ ped_exception_get_type_string()
Return a string describing an exception type.
◆ ped_exception_leave_all()
void ped_exception_leave_all |
( |
| ) |
|
Indicates that the calling function does not want to accept any responsibility for exceptions any more.
- Note
- a caller of that function may still want responsibility, so ped_exception_throw() may not invoke the exception handler.
- Warning
- every call to this function must have a preceding ped_exception_fetch_all().
◆ ped_exception_rethrow()
◆ ped_exception_set_handler()
Set the exception handler.
The exception handler should return ONE of the options set in ex->options, indicating the way the event should be resolved.
◆ ped_exception_throw()
Throw an exception.
You can also use this in a program using libparted. "message" is a printf-like format string, so you can do
"Can't open %s", file_name);
PedExceptionOption ped_exception_throw(PedExceptionType ex_type, PedExceptionOption ex_opt, const char *message,...)
Throw an exception.
Definition: exception.c:230
@ PED_EXCEPTION_ERROR
Definition: exception.h:38
@ PED_EXCEPTION_RETRY_CANCEL
Definition: exception.h:66
Returns the option selected to resolve the exception. If the exception was unhandled, PED_EXCEPTION_UNHANDLED is returned.
◆ ped_exception [1/3]
◆ ped_exception [2/3]
◆ ped_exception [3/3]