1

If I'm going to use a client generator like AutoRest, do I want that generated client to anticipate 500 errors?

Or, am I expected to wrap the client requests in try/catch?

Is this just a stylistic decision I need to make?

4

1 回答 1

2

对于Swagger Codegen(免费、开源),API 客户端通常会为 4xx 或 5xx HTTP 响应返回一个异常(例如 ApiException),因为它表明发生了错误(例如,删除数据库中不存在的对象)并且通常是 ApiException 对象包含有关服务器返回的错误的所有信息。

于 2017-07-19T14:36:49.433 回答