我有一个小问题,调试所有的应用程序后,我注意到,这是造成问题的文件,返回我UnhandledPromiseRejection
的NodeJS:未处理的承诺拒绝
'use strict'
const connection = require('../models/'),
oracledb = require('oracledb'),
conexion = oracledb.getConnection(connection)
oracledb.outFormat = oracledb.OBJECT;
module.exports = {
index(req, res) {
conexion.then(con => {
return con.execute(
`SELECT id_application, name, description, creation_date ` +
`FROM application `
).then(bucket => {
return con.execute(
`SELECT id_definition, id_application, field_name_original, field_name_new,
column_name, position, id_type_data, field_size, creation_date,
description, filter, visible ` +
`FROM definition `
).then(definitions => {
res.status(200).json(creaJSON(bucket, definitions))
}).catch(error => { return res.status(500).json({'message': error}) })
}).catch(err => { return res.status(500).json({'message': err}) })
}).catch(err => { return res.status(500).json({'message': err}) })
},
create(req, res) {
},
update(req, res) {
}
}
const doRelease = (connection) => {
connection.close((err) => {
if(err) console.error(err.message);
})
}
const creaJSON = (buckets, definitions) => {
var df = new Array()
buckets['rows'].map(obj => {
definitions['rows'].map(def => {
if(obj['ID_APPLICATION'] == def['ID_APPLICATION']) df.push(def)
})
obj['Definitions'] = df
df = []
})
return buckets.rows
}
的UnhandledPromiseRejection
后,被跟踪由:Error: ORA-12170: TNS:Connect timeout occurred
(node:1270) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.JS process with a non-zero exit code.
我已经找了解决方案,有的说应许不要再追正确,但我看不出有任何问题与他们。任何其他建议?
任何帮助将受到欢迎。
由于
不错,我现在不能尝试,因为我不在工作,但星期一会检查它。非常感谢。 @ Traktor53 –
很好,谢谢,'''UnhandledPromiseRejection'''不见了,现在我只有'''错误:ORA-12170:TNS:发生连接超时'''哈哈哈哈。我会检查一下,如果我能解决这个问题,如果没有,我会打开另一个问题。谢谢你,先生。 –