javascript - Feathers js - 不能在地图功能中抛出错误
问题描述
/test
当我使用 Postman向端点发送请求时,
但相反,它仅在控制台上显示错误并且请求成功
Console:
error: same result is here! {"type":"FeathersError","name":"Conflict","code":409,"className":"conflict","errors":{}}
测试钩子.js
const errors = require('@feathersjs/errors');
module.exports = {
before: {
all: [],
find: [
async context=>{
if(xxxx){
if(xxx){
data.map(x => {
throw new errors.Conflict('same result is here!')
})
}
}
}
],
...
},
after: {
...
},
error: {
...
}
};
解决方案
推荐阅读
- bash - 将命令历史记录到 docker 主机
- shell - 使用 find 查找名称中包含不可打印字符的文件
- javascript - 为快速路由器创建装饰器?
- codenameone - 如何解决这个问题在 Ios 中的代号中绘制路径?
- azure - 是否可以使用 Azure Policy 为 IAM 中的用户/组分配角色?
- python - yoyo-migrations 全新安装 conda 错误
- php - 无法在简单的 HTML 页面上使用 PHP 邮件功能发送电子邮件。无效的方法动词错误
- php - PHP | 将 JSON POST 发送到 API URL 时出错
- javascript - 如何编写在单击指定按钮时获取不同背景图像和文本的函数?
- python - 用 Pandas 数据框中的模式替换特殊字符和空值