HACKER
TALK
Home
Channels
beta
Bookmarks
Messages
Notifications
Sign In
Comment
想问下各位后端错误处理怎么做比较优雅?
看了一些大厂的接口,不少都是直接 200 返回的,然后带个错误码。业务逻辑上是直接 service 层包装一下直接返回还是直接抛 Exception 的好?
HD Superman
·
3 years ago
Across the Great Wall, we can reach every corner in the world.
可以参考 google 的 api 规范:
API design error
,黑客说的错误处理就是这套实现。
1
Reply
Report
HD Superman
Joined 3 years ago
Across the Great Wall, we can reach every corner in the world.
github.com/hdsuperman
Follow
Message