lingdu1234 / axum_admin

axum admin rust vue
https://314.iu1314.top/
227 stars 42 forks source link

我感觉在 Res::with_err 中分类err进行判断比较好 #20

Open ranmeizi opened 1 year ago

ranmeizi commented 1 year ago

可以在service controller 中返回自定义的 thiserror:error 调用 Res::with_err(err:anyhow::Error) 然后再with_err 中可以去downcast_ref 判断错误类型并返回相应的信息,错误信息可以自定义,更灵活一些