@bee.js/node 0.0.61 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/beehive.js +9 -5
- package/package.json +1 -1
package/beehive.js
CHANGED
|
@@ -43,10 +43,11 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
43
43
|
|
|
44
44
|
global.beeDBPool = global.beeDBPool || beeORM.createPool(global.configs);
|
|
45
45
|
result = await global.beeDBPool.query(SQL, binds);
|
|
46
|
-
} catch (
|
|
47
|
-
log("
|
|
48
|
-
log(
|
|
49
|
-
|
|
46
|
+
} catch (_error) {
|
|
47
|
+
log("####################### DB ERROR #######################");
|
|
48
|
+
log(_error);
|
|
49
|
+
log(SQL);
|
|
50
|
+
_error = e;
|
|
50
51
|
errorCode = 502;
|
|
51
52
|
} finally {
|
|
52
53
|
if (global.configs.debug) debug.push(SQL);
|
|
@@ -393,7 +394,7 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
393
394
|
_data = await dbExec(sql.SQL, sql.binds);
|
|
394
395
|
|
|
395
396
|
inserts.push({ ..._data, model: model.table });
|
|
396
|
-
this.insertId = _data
|
|
397
|
+
this.insertId = _data?.insertId;
|
|
397
398
|
|
|
398
399
|
return { ...this, result: { ...sql.result, ..._data } };
|
|
399
400
|
},
|
|
@@ -460,6 +461,9 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
460
461
|
response: function (sendData = data, action = null, status) {
|
|
461
462
|
let out = { data: sendData, counters, action, error };
|
|
462
463
|
|
|
464
|
+
if (res.headersSent)
|
|
465
|
+
return console.error("ERROR beejs: headers already sent");
|
|
466
|
+
|
|
463
467
|
if (inserts.length) out.inserts = inserts;
|
|
464
468
|
|
|
465
469
|
if (global.configs.debug) out.debug = debug;
|