@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.
Files changed (2) hide show
  1. package/beehive.js +9 -5
  2. 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 (e) {
47
- log("####### DB ERROR:");
48
- log(e);
49
- error = e;
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.insertId;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bee.js/node",
3
- "version": "0.0.61",
3
+ "version": "0.0.63",
4
4
  "description": "A JavaScript framework for making Node.js API´s",
5
5
  "main": "index.js",
6
6
  "scripts": {