From Jason Turner

[fs.err.report]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpz64c4_8_/{from.md → to.md} +46 -0
tmp/tmpz64c4_8_/{from.md → to.md} RENAMED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Error reporting <a id="fs.err.report">[[fs.err.report]]</a>
2
+
3
+ Filesystem library functions often provide two overloads, one that
4
+ throws an exception to report file system errors, and another that sets
5
+ an `error_code`.
6
+
7
+ [*Note 1*:
8
+
9
+ This supports two common use cases:
10
+
11
+ - Uses where file system errors are truly exceptional and indicate a
12
+ serious failure. Throwing an exception is an appropriate response.
13
+ - Uses where file system errors are routine and do not necessarily
14
+ represent failure. Returning an error code is the most appropriate
15
+ response. This allows application specific error handling, including
16
+ simply ignoring the error.
17
+
18
+ — *end note*]
19
+
20
+ Functions not having an argument of type `error_code&` handle errors as
21
+ follows, unless otherwise specified:
22
+
23
+ - When a call by the implementation to an operating system or other
24
+ underlying API results in an error that prevents the function from
25
+ meeting its specifications, an exception of type `filesystem_error`
26
+ shall be thrown. For functions with a single path argument, that
27
+ argument shall be passed to the `filesystem_error` constructor with a
28
+ single path argument. For functions with two path arguments, the first
29
+ of these arguments shall be passed to the `filesystem_error`
30
+ constructor as the `path1` argument, and the second shall be passed as
31
+ the `path2` argument. The `filesystem_error` constructor’s
32
+ `error_code` argument is set as appropriate for the specific operating
33
+ system dependent error.
34
+ - Failure to allocate storage is reported by throwing an exception as
35
+ described in  [[res.on.exception.handling]].
36
+ - Destructors throw nothing.
37
+
38
+ Functions having an argument of type `error_code&` handle errors as
39
+ follows, unless otherwise specified:
40
+
41
+ - If a call by the implementation to an operating system or other
42
+ underlying API results in an error that prevents the function from
43
+ meeting its specifications, the `error_code&` argument is set as
44
+ appropriate for the specific operating system dependent error.
45
+ Otherwise, `clear()` is called on the `error_code&` argument.
46
+