Error handling refactor
This refactor aims to improve error handling throughout the project by refining the overarching error types and increasing usage of proper error handling. Replaced existing networked operation error with `NetworkOperationError`. `NetworkOperationError` does not forward any internal error details, which allows `OperationError` to grow into a better error type. `OperationError` now has support for storing real typed errors inside of it for better debugging. `IntoInternalError` is a trait which allows for easy conversion of error types into `OperationError::internal`.
parent: tbd commit: e02c03d
1 | use Display; |
2 | |
3 | use ; |
4 | |
5 | |
6 | |
7 | |
8 | RegistrationFailure, |
9 | |
10 | AuthenticationFailed, |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | InvalidObject, |
23 | |
24 | |
25 | |
26 | |
27 | ; |
28 | |
29 | |
30 | |
31 | |
32 | Operation, |
33 | |
34 | Internal, |
35 | |
36 | Unhandled, |
37 | |
38 | |
39 | |
40 | ; |
41 | |
42 | |
43 | |
44 | C: Display + Send + Sync + 'static, |
45 | |
46 | let internal_error = self.; |
47 | |
48 | match internal_error |
49 | Ok => Ok, |
50 | Err => |
51 | Err |
52 | |
53 | _ => unreachable!, |
54 | |
55 | |
56 | |
57 | |
58 | |
59 | |
60 | match self |
61 | Ok => Ok, |
62 | Err => Err, |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | match self |
70 | => | Operation
71 | Operation |
72 | |
73 | => Internal, | Internal
74 | => Unhandled, | Unhandled
75 | |
76 | |
77 | |
78 | |
79 | |
80 | |
81 | ; |
82 | |
83 | |
84 | |
85 | todo! |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | Operation, |
93 | |
94 | Internal, |
95 | |
96 | Unhandled, |
97 | |
98 |