在(几乎)相同的创建中遇到来自 Waterline 的意外错误
Encountered an unexpected error from Waterline in (pretty much) identical create's
运行以下代码创建一个新的数据库(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 中添加了一些额外的日志记录(终于在正确的位置)以捕获所有已保存的数据,失败的不是供应商的创建而是发票行项目的插入(发生在供应商 created/updated 之后)。
一些 timing/correlation 故障使 Sails 在创建供应商后(可能在交易结束时)抛出错误,为什么我看错了地方...修复发票项目的验证错误数据解决了问题!
运行以下代码创建一个新的数据库(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 中添加了一些额外的日志记录(终于在正确的位置)以捕获所有已保存的数据,失败的不是供应商的创建而是发票行项目的插入(发生在供应商 created/updated 之后)。
一些 timing/correlation 故障使 Sails 在创建供应商后(可能在交易结束时)抛出错误,为什么我看错了地方...修复发票项目的验证错误数据解决了问题!