假设我在调用服务时抛出 GeneralError,如何制作我想要的错误对象:
{
"status": "Failed",
"code": "500_1",
"detail": "Something is wrong with your API"
}
我已经尝试在错误钩子上添加这个
hook => {
hook.error = {
"status": "Failed",
"code": "500_1",
"detail": "Something is wrong with your API"
}
return hook
}
但仍然不能,并且仍然返回羽毛的默认错误对象:
{
"name": "GeneralError",
"message": "Error",
"code": 500,
"className": "general-error",
"data": {},
"errors": {}
}