File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,34 @@ and monitoring of system commands or applications directly from Fortran.
99
1010[ TOC]
1111
12+ ## ` fs_error ` - A derived type for concise error handling
13+
14+ ### Status
15+
16+ Experimental
17+
18+ ### Description
19+
20+ The derived type contains a ` code ` , an integer and a fixed-length string containg a user friendly message.
21+ The code is usually the one returned by C functions like ` GetLastError ` (Windows API) or global variables like ` errno ` (Unix platforms)
22+ It is default initialized to ` 0 ` and it remains so if no errors occured.
23+ In case the error is not because of any C functions, It is always set to ` -1 ` (For distinguishability)
24+
25+ ### Type-bound Procedures
26+
27+ The following convenience type-bound procedures are provided:
28+ - ` print() ` returns a formatted allocatable character string containing the code and the message;
29+ - ` ok() ` returns a ` logical ` flag that is ` .true. ` in case of no errors (` code == 0 ` );
30+ - ` error() ` returns a ` logical ` flag that is ` .true. ` in case of an error (` code /= 0 ` ).
31+ - ` handle([err]) ` assigns ` err ` to the calling variable or stops the program by calling ` error stop `
32+
33+ ### Example
34+
35+ ```
36+ fortran
37+ {!example/system/example_fs_error.f90!}
38+ ```
39+
1240## ` run ` - Execute an external process synchronously
1341
1442### Status
You can’t perform that action at this time.
0 commit comments