ITK Function Reference

(V10000.1.0.60_20160308.00)
error_protect.h
Go to the documentation of this file.
1 /*HEAD ERROR_PROTECT HHH SYSS */
2 /*===============================================================================
3 
4  Copyright (c) 2003 Unigraphics Solutions Inc.
5  Unpublished - All rights reserved
6 
7 =================================================================================
8 File description:
9 
10 Header file to define the normal macros for error handling in application code.
11 The normal usage of these macros is described here:
12 
13  ERROR_PROTECT
14 
15  mark = set_markpoint();
16  make_a_part();
17  save_part(file_name);
18 
19  ERROR_RECOVER
20 
21  int code = ERROR_ask_failure_code();
22 
23  if (code == OM_err_disk_full ||
24  code == ERROR_KI_base + KI_disc_full)
25  {
26  -- perhaps we have code to try again with a --
27  -- filename on a different disk --
28 
29  ERROR_acknowledge_handled ( );
30  }
31  else
32  {
33  -- other errors we can't recover from here --
34  -- undo and reraise --
35 
36  undo_to_mark(mark);
37  ERROR_reraise();
38  }
39 
40  ERROR_END
41 
42 In an ERROR_RECOVER block, there are two possibilities: either the error will
43 be processed within the block and the error will be acknowledged, or the
44 error will not be recognized within the block and it will be re-raised to the
45 next ERROR_RECOVER block. For every error, these are the only two choices --
46 either call ERROR_reraise() or call ERROR_acknowledge_handled(). Only the
47 Standard exception will be allowed to pass to the line after ERROR_END, and
48 that will only happen if the exception has been acknowledged.
49 
50 
51 =================================================================================
52  Date Name Description of Change
53 NX3
54 17-Jul-2003 Lavarini Split from error.h
55 19-Sep-2003 Lavarini Add more header files to pragma
56 $HISTORY$
57 ================================================================================*/
58 
59 #ifndef ERROR_PROTECT_H_INCLUDED
60 #define ERROR_PROTECT_H_INCLUDED
61 
62 #ifdef __lint
63 # pragma uginclude only_in_error "csfadpmacros.hxx","error.h","*.c","*.cxx",\
64  "*.cpp";
65 #endif
66 
67 #include <error_c_cxx_interface.h>
68 
69 #define ERROR_PROTECT ERROR_DEFAULT_PROTECT
70 
71 #define ERROR_RECOVER ERROR_DEFAULT_RECOVER(ERROR_PROTECT_TYPE)
72 
73 #define ERROR_END ERROR_DEFAULT_END(ERROR_PROTECT_TYPE)
74 
75 #endif /* ERROR_PROTECT_H_INCLUDED */