Commit 61b3c54
authored
[local_auth] Adopt structured errors, and remove
Switches from `PlatformException`s to new `LocalAuthException`s, which contain structured error information (specifically, a code that is a documented enum, rather than a list of magic strings that are used inconsistently and not all documented), bringing the plugin into alignment with [our current best practices](https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#platform-exception-handling. In addition to being clearer and easier to use for clients, this adds significantly more granular error codes than we currently have, which allows clients to better handle specific cases.
Since this must be done as a breaking change (since the current `PlatformException`s are a combination of documented and de-facto API), this batches another breaking change, which is removing the error dialogs from the plugin, for the reasons described in flutter/flutter#175125.
Since this is adding far more specific error codes, the PR also makes the internal change of passing essentially all native failure cases across the language boundary and then doing mapping to the cross-platform codes in Dart code, in keeping with our general recent practice of moving logic to the Dart side when there's no need for it to be native.
Fixes flutter/flutter#113687
Fixes flutter/flutter#175125
Fixes flutter/flutter#151513
Fixes flutter/flutter#132757
Fixes flutter/flutter#148947
Fixes flutter/flutter#173506
Fixes flutter/flutter#174191
Closes flutter/flutter#96646
Fixes flutter/flutter#117810
Closes flutter/flutter#141283
Closes flutter/flutter#173142
## Pre-Review Checklist
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.useErrorDialogs (#9981)1 parent 6d10279 commit 61b3c54
File tree
10 files changed
+124
-198
lines changed- packages/local_auth/local_auth
- example
- lib
- lib
- src
- test
10 files changed
+124
-198
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
3 | 14 | | |
4 | | - | |
| 15 | + | |
| 16 | + | |
5 | 17 | | |
6 | 18 | | |
7 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
| 69 | + | |
71 | 70 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
86 | 74 | | |
87 | 75 | | |
88 | 76 | | |
89 | 77 | | |
90 | 78 | | |
91 | | - | |
| 79 | + | |
92 | 80 | | |
93 | 81 | | |
94 | 82 | | |
95 | 83 | | |
96 | 84 | | |
97 | | - | |
| 85 | + | |
98 | 86 | | |
99 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
100 | 93 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 94 | + | |
133 | 95 | | |
134 | | - | |
| 96 | + | |
135 | 97 | | |
136 | 98 | | |
137 | 99 | | |
| |||
158 | 120 | | |
159 | 121 | | |
160 | 122 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
164 | 126 | | |
165 | 127 | | |
166 | 128 | | |
167 | | - | |
168 | | - | |
169 | 129 | | |
170 | 130 | | |
171 | 131 | | |
172 | 132 | | |
173 | 133 | | |
174 | 134 | | |
175 | 135 | | |
176 | | - | |
177 | 136 | | |
178 | 137 | | |
179 | | - | |
180 | | - | |
| 138 | + | |
| 139 | + | |
181 | 140 | | |
182 | | - | |
183 | | - | |
| 141 | + | |
| 142 | + | |
184 | 143 | | |
185 | 144 | | |
186 | 145 | | |
| |||
287 | 246 | | |
288 | 247 | | |
289 | 248 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| |||
86 | 84 | | |
87 | 85 | | |
88 | 86 | | |
89 | | - | |
| 87 | + | |
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
93 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
97 | 106 | | |
98 | | - | |
| 107 | + | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
| |||
118 | 127 | | |
119 | 128 | | |
120 | 129 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 130 | + | |
| 131 | + | |
125 | 132 | | |
126 | 133 | | |
127 | 134 | | |
128 | 135 | | |
129 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
134 | | - | |
| 152 | + | |
135 | 153 | | |
136 | 154 | | |
137 | 155 | | |
| |||
Lines changed: 7 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
64 | 60 | | |
65 | 61 | | |
66 | 62 | | |
67 | | - | |
68 | | - | |
| 63 | + | |
| 64 | + | |
69 | 65 | | |
70 | 66 | | |
71 | 67 | | |
| |||
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | 78 | | |
98 | 79 | | |
99 | 80 | | |
100 | 81 | | |
101 | | - | |
| 82 | + | |
102 | 83 | | |
103 | 84 | | |
104 | 85 | | |
105 | 86 | | |
106 | 87 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 88 | | |
130 | 89 | | |
131 | 90 | | |
132 | 91 | | |
133 | 92 | | |
134 | | - | |
135 | 93 | | |
136 | 94 | | |
137 | 95 | | |
138 | 96 | | |
139 | | - | |
140 | | - | |
| 97 | + | |
| 98 | + | |
141 | 99 | | |
142 | | - | |
143 | | - | |
| 100 | + | |
| 101 | + | |
144 | 102 | | |
145 | 103 | | |
146 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments