badmfck-api-server 4.1.16 → 4.1.17

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.
@@ -98,7 +98,7 @@ async function Initializer(services) {
98
98
  }
99
99
  exports.Initializer = Initializer;
100
100
  class APIService extends BaseService_1.BaseService {
101
- version = "4.1.16";
101
+ version = "4.1.17";
102
102
  options;
103
103
  monitor = null;
104
104
  started = new Date();
@@ -19,6 +19,8 @@ export interface IDBQuery {
19
19
  query: string;
20
20
  fields?: IDBQueryFields;
21
21
  throwable?: boolean;
22
+ onDuplicateErrorText?: string;
23
+ onErrorText?: string;
22
24
  transactionID?: number;
23
25
  rollbackOnFail?: boolean;
24
26
  calculateCount?: boolean;
@@ -554,6 +554,10 @@ class MysqlAdapter {
554
554
  this.storeTransactionAsProblem(trx, "error:" + error.errno);
555
555
  if (request.throwable) {
556
556
  const base = error.isDuplicateError ? DefaultErrors_1.default.DB_DUPLICATE_ERROR : DefaultErrors_1.default.DB_ERROR;
557
+ const customText = error.isDuplicateError ? request.onDuplicateErrorText : request.onErrorText;
558
+ if (customText) {
559
+ throw { ...base, message: customText, details: error.message };
560
+ }
557
561
  throw { ...base, details: error.message, stack: error };
558
562
  }
559
563
  return {