@@ -241,26 +241,27 @@ Note: it shouldn't be used in `editoast` as we now have enums variants we can `m
241
241
#[derive(Debug , thiserror:: Error , ViewError )]
242
242
enum Error {
243
243
#[view_error(user)]
244
- No { because : String }, // { }
244
+ NoContext { because : String }, // context = { }
245
245
246
246
#[view_error(user, context)]
247
- Nein { reasons : Vec <String > }, // { "reasons": [string] }
247
+ AllFieldsIntoContext { reasons : Vec <String > }, // context = { "reasons": [string] }
248
248
249
- // select (and maybe rename) some fields
249
+ // select (and maybe rename) some fields to include to the context
250
250
#[view_error(user, context(reason, recovery_id = " recovery" ))]
251
- QueNo {
251
+ SomeFieldsIntoContext {
252
252
reason : String ,
253
253
recovery_id : String ,
254
- not_serializable : mspc :: Send <()>
255
- },
254
+ not_serializable : mpsc :: Sender <()>,
255
+ not_wanted : u64 ,
256
+ }, // context = { "reason": string, "recovery": string }
256
257
}
257
258
258
259
// with a provider function
259
260
#[derive(Debug , thiserror:: Error , ViewError )]
260
261
#[view_error(context_with = context_provider)]
261
262
enum Error {
262
- Nao (String ),
263
- Nee (String , u64 )
263
+ Variant1 (String ),
264
+ Variant2 (String , u64 )
264
265
}
265
266
266
267
fn context_provider (error : Error ) -> HashMap <String , serde_json :: Value > {
0 commit comments