运行以下代码创建一个新的数据库(PostgreSQL 11.3(行:
const supplier = await Supplier.create(
Object.assign({}, entityData, {
last_activity_date: sails.services.datehelper.GetTimeNow(),
account: supplierParams.supplier,
monitored: !!activeRegistry,
verified: true
})
);
error: Error (E_UNKNOWN) :: Encountered an unexpected error
at new WLError (invoice-portal/node_modules/waterline/lib/waterline/error/WLError.js:25:15)
at invoice-portal/node_modules/waterline/lib/waterline/model/lib/defaultMethods/save.js:188:17
at invoice-portal/node_modules/waterline/node_modules/async/lib/async.js:52:16
at invoice-portal/node_modules/waterline/node_modules/async/lib/async.js:550:17
at invoice-portal/node_modules/waterline/node_modules/async/lib/async.js:544:17
at _arrayEach (invoice-portal/node_modules/waterline/node_modules/async/lib/async.js:85:13)
at Immediate.taskComplete (invoice-portal/node_modules/waterline/node_modules/async/lib/async.js:543:13)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
我在invoice portal/node_modules/waterline/lib/waterline/model/lib/defaultMethods/save.js中添加了一些额外的日志记录(最终在正确的位置(,以捕获所有保存的数据,失败的不是供应商的创建,而是发票行项目的插入(在供应商创建/更新后发生(。
一些时间/相关性故障使Sails在创建供应商后(可能是在交易结束时(抛出错误,为什么我看错了地方。。。修复发票项数据的验证错误解决了问题!