错误处理
¥Error handling
Strapi 本身就以标准格式处理错误。
¥Strapi is natively handling errors with a standard format.
错误处理有 2 个用例:
¥There are 2 use cases for error handling:
-
作为通过 REST 或 GraphQL API 查询内容的开发者,你可能会 接收错误 来响应请求。
¥As a developer querying content through the REST or GraphQL APIs, you might receive errors in response to the requests.
-
作为自定义 Strapi 应用后端的开发者,你可以使用 抛出错误 的控制器和服务。
¥As a developer customizing the backend of your Strapi application, you could use controllers and services to throw errors.