@itrocks/mysql-maintainer 0.2.0 → 0.2.1

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.
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Contextual = void 0;
4
- const mariadb_1 = require("mariadb");
5
4
  const mysql_maintainer_1 = require("./mysql-maintainer");
6
5
  const mysql_maintainer_2 = require("./mysql-maintainer");
7
6
  const MANAGED_ERROR_CODES = ['ER_BAD_FIELD_ERROR', 'ER_CANNOT_ADD_FOREIGN', 'ER_NO_SUCH_TABLE'];
@@ -21,8 +20,7 @@ class Contextual {
21
20
  return await this.superQuery(sql, values);
22
21
  }
23
22
  catch (error) {
24
- if (!(error instanceof mariadb_1.SqlError)
25
- || !error.code
23
+ if (!(error && (typeof error === 'object') && error.code)
26
24
  || !MANAGED_ERROR_CODES.includes(error.code)) {
27
25
  if (mysql_maintainer_1.DEBUG)
28
26
  console.log('MAINTAINER: throw', error);
@@ -1,4 +1,3 @@
1
- import { SqlError } from 'mariadb';
2
1
  import { DEBUG } from './mysql-maintainer';
3
2
  import { MysqlMaintainer } from './mysql-maintainer';
4
3
  const MANAGED_ERROR_CODES = ['ER_BAD_FIELD_ERROR', 'ER_CANNOT_ADD_FOREIGN', 'ER_NO_SUCH_TABLE'];
@@ -18,8 +17,7 @@ export class Contextual {
18
17
  return await this.superQuery(sql, values);
19
18
  }
20
19
  catch (error) {
21
- if (!(error instanceof SqlError)
22
- || !error.code
20
+ if (!(error && (typeof error === 'object') && error.code)
23
21
  || !MANAGED_ERROR_CODES.includes(error.code)) {
24
22
  if (DEBUG)
25
23
  console.log('MAINTAINER: throw', error);
package/package.json CHANGED
@@ -57,5 +57,5 @@
57
57
  "build:esm": "tsc -p tsconfig.esm.json"
58
58
  },
59
59
  "types": "./esm/mysql-maintainer.d.ts",
60
- "version": "0.2.0"
60
+ "version": "0.2.1"
61
61
  }