Skip to content

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

Description

@ranmeizi

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions