libparted 3.6
Loading...
Searching...
No Matches
exception.in.h
Go to the documentation of this file.
1/*
2 libparted - a library for manipulating disk partitions
3 Copyright (C) 1999-2000, 2007, 2009-2014, 2019-2023 Free Software
4 Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
27#ifndef PED_EXCEPTION_H_INCLUDED
28#define PED_EXCEPTION_H_INCLUDED
29
31
42};
44
49 /* individual options */
58
59 /* combinations of individual options */
69};
70
71#define PED_EXCEPTION_OPTION_FIRST PED_EXCEPTION_FIX
72#define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL /* last individual option */
73
75
79struct _PedException {
80 char* message;
86};
87
89
90extern int ped_exception; /* set to true if there's an exception */
91
93 _GL_ATTRIBUTE_CONST;
95 _GL_ATTRIBUTE_PURE;
96
99 _GL_ATTRIBUTE_PURE;
100
102
104 PedExceptionOption ex_opt,
105 const char* message,
106 ...);
107/* rethrows an exception - i.e. calls the exception handler, (or returns a
108 code to return to pass up higher) */
110
111/* frees an exception, indicating that the exception has been handled.
112 Calling an exception handler counts. */
113extern void ped_exception_catch ();
114
115/* indicate that exceptions should not go to the exception handler, but passed
116 up to the calling function(s) */
117extern void ped_exception_fetch_all ();
118
119/* indicate that exceptions should invoke the exception handler */
120extern void ped_exception_leave_all ();
121
122#endif /* PED_EXCEPTION_H_INCLUDED */
123
void ped_exception_set_handler(PedExceptionHandler *handler)
Set the exception handler.
Definition: exception.c:166
PedExceptionOption ped_exception_throw(PedExceptionType ex_type, PedExceptionOption ex_opt, const char *message,...)
Throw an exception.
Definition: exception.c:230
PedExceptionOption ped_exception_rethrow()
Rethrow an unhandled exception.
Definition: exception.c:280
char * ped_exception_get_type_string(PedExceptionType ex_type)
Return a string describing an exception type.
Definition: exception.c:101
PedExceptionOption ped_exception_default_handler(PedException *ex)
PedExceptionOption() PedExceptionHandler(PedException *ex)
Definition: exception.in.h:88
_PedExceptionType
Exception type.
Definition: exception.h:35
char * ped_exception_get_option_string(PedExceptionOption ex_opt)
Return a string describing an exception option.
Definition: exception.c:124
PedExceptionHandler * ped_exception_get_handler(void)
Get the current exception handler.
Definition: exception.c:178
void ped_exception_leave_all()
Indicates that the calling function does not want to accept any responsibility for exceptions any mor...
Definition: exception.c:307
_PedExceptionOption
Option for resolving the exception.
Definition: exception.h:48
void ped_exception_fetch_all()
Indicates that exceptions should not go to the exception handler, but passed up to the calling functi...
Definition: exception.c:291
enum _PedExceptionType PedExceptionType
Definition: exception.in.h:43
int ped_exception
Definition: exception.c:70
enum _PedExceptionOption PedExceptionOption
Definition: exception.in.h:74
void ped_exception_catch()
Assert that the current exception has been resolved.
Definition: exception.c:189
@ PED_EXCEPTION_BUG
Definition: exception.in.h:40
@ PED_EXCEPTION_INFORMATION
Definition: exception.in.h:36
@ PED_EXCEPTION_WARNING
Definition: exception.in.h:37
@ PED_EXCEPTION_NO_FEATURE
Definition: exception.in.h:41
@ PED_EXCEPTION_FATAL
Definition: exception.in.h:39
@ PED_EXCEPTION_ERROR
Definition: exception.in.h:38
@ PED_EXCEPTION_RETRY
Definition: exception.in.h:55
@ PED_EXCEPTION_RETRY_CANCEL
Definition: exception.in.h:66
@ PED_EXCEPTION_IGNORE_CANCEL
Definition: exception.in.h:64
@ PED_EXCEPTION_CANCEL
Definition: exception.in.h:57
@ PED_EXCEPTION_YES_NO_CANCEL
Definition: exception.in.h:62
@ PED_EXCEPTION_FIX
Definition: exception.in.h:51
@ PED_EXCEPTION_NO
Definition: exception.in.h:53
@ PED_EXCEPTION_OK_CANCEL
Definition: exception.in.h:60
@ PED_EXCEPTION_RETRY_IGNORE_CANCEL
Definition: exception.in.h:67
@ PED_EXCEPTION_IGNORE
Definition: exception.in.h:56
@ PED_EXCEPTION_YES_NO
Definition: exception.in.h:61
@ PED_EXCEPTION_YES
Definition: exception.in.h:52
@ PED_EXCEPTION_OK
Definition: exception.in.h:54
@ PED_EXCEPTION_UNHANDLED
Definition: exception.in.h:50
Structure with information about exception.
Definition: exception.h:79
PedExceptionType type
type of exception
Definition: exception.h:81
PedExceptionOption options
ORed list of options that the exception handler can return (the ways an exception can be resolved)
Definition: exception.h:82
char * message
text describing what the event was
Definition: exception.h:80