Commit 3a183ce
authored
[Fix] Add support for all error details types and fix potential unmarshalling error (#912)
## What changes are proposed in this pull request?
This PR refactors how `DatabricksError` processes error details to fully
support the Databricks Error specification. In particular, it provides a
clear mechanism to access known error details types while still enabling
users to access unknown error details.
The core of the PR is the addition of a new `ErrorDetails` type which
operates as the union of all error details type. It implements the fact
that an error response should only contain at most one instance of each
type.
The code is purposely structured to hide implementation details by
separating the exported error details types from their unmarshalling
logic. This arguably leads to code that might be more complicated that
it ought to be. We could consider further simplifying it in the future
(e.g. by relying on the corresponding proto unmarshallers).
## How is this tested?
100% unit tests coverage of new code + slight refactor of the test
suite.1 parent a1185d2 commit 3a183ce
File tree
6 files changed
+756
-170
lines changed- databricks/sdk/errors
- tests
6 files changed
+756
-170
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
61 | | - | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
75 | | - | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| 101 | + | |
91 | 102 | | |
92 | 103 | | |
93 | 104 | | |
94 | | - | |
| 105 | + | |
95 | 106 | | |
96 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
97 | 116 | | |
98 | | - | |
| 117 | + | |
99 | 118 | | |
100 | 119 | | |
101 | | - | |
| 120 | + | |
102 | 121 | | |
103 | 122 | | |
104 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
105 | 127 | | |
106 | 128 | | |
107 | 129 | | |
| |||
0 commit comments