baja-lite 1.8.4 → 1.8.5

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/package.json +2 -2
  2. package/sql.js +9 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/baja-lite",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "pino": "10.3.1",
44
44
  "pino-pretty": "13.1.3",
45
45
  "reflect-metadata": "0.2.2",
46
- "sql-formatter": "15.7.3",
46
+ "sql-formatter": "15.8.0",
47
47
  "sqlstring": "2.3.3",
48
48
  "tslib": "2.8.1"
49
49
  },
package/sql.js CHANGED
@@ -18,7 +18,7 @@ import pino from 'pino';
18
18
  import { formatDialect, mysql, postgresql, sqlite } from 'sql-formatter';
19
19
  import tslib from 'tslib';
20
20
  import { convert } from './convert-xml.js';
21
- import { DatabaseError, Throw } from './error.js';
21
+ import { Throw } from './error.js';
22
22
  import { excuteSplit, ExcuteSplitMode, sleep } from './fn.js';
23
23
  import { add, calc, ten2Any } from './math.js';
24
24
  import { C2P, C2P2, P2C } from './object.js';
@@ -248,9 +248,8 @@ class MysqlConnection {
248
248
  resolve({ affectedRows: result.affectedRows, insertId: result.insertId });
249
249
  }
250
250
  catch (error) {
251
- const dbError = DatabaseError.query('MySQL execute failed', sql, params, error);
252
- globalThis[_LoggerService].error(dbError.getSafeMessage(), { cause: error });
253
- reject(dbError);
251
+ globalThis[_LoggerService].error(error.message, { cause: error });
252
+ reject(error);
254
253
  }
255
254
  });
256
255
  }
@@ -443,9 +442,8 @@ export class Mysql {
443
442
  resolve(new MysqlConnection(connection));
444
443
  }
445
444
  catch (error) {
446
- const dbError = DatabaseError.connection('Failed to create MySQL connection', error);
447
- globalThis[_LoggerService].error(dbError.getSafeMessage(), { cause: error });
448
- reject(dbError);
445
+ globalThis[_LoggerService].error(error.message, { cause: error });
446
+ reject(error);
449
447
  }
450
448
  });
451
449
  }
@@ -484,9 +482,8 @@ export class Mysql {
484
482
  await conn[_daoConnection].rollback();
485
483
  globalThis[_LoggerService].debug?.('rollback end!');
486
484
  }
487
- const dbError = error instanceof DatabaseError ? error : DatabaseError.transaction('MySQL transaction failed', error);
488
- globalThis[_LoggerService].error(dbError.getSafeMessage(), { cause: error });
489
- reject(dbError);
485
+ globalThis[_LoggerService].error(error.message, { cause: error });
486
+ reject(error);
490
487
  }
491
488
  finally {
492
489
  try {
@@ -802,9 +799,8 @@ export class Postgresql {
802
799
  await conn[_daoConnection].query('ROLLBACK');
803
800
  globalThis[_LoggerService].debug?.('rollback end!');
804
801
  }
805
- const dbError = error instanceof DatabaseError ? error : DatabaseError.transaction('PostgreSQL transaction failed', error);
806
- globalThis[_LoggerService].error(dbError.getSafeMessage(), { cause: error });
807
- reject(dbError);
802
+ globalThis[_LoggerService].error(error.message, { cause: error });
803
+ reject(error);
808
804
  }
809
805
  finally {
810
806
  try {