badmfck-api-server 4.1.11 → 4.1.12
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.
|
@@ -552,8 +552,10 @@ class MysqlAdapter {
|
|
|
552
552
|
}
|
|
553
553
|
if (trx && !error.isDuplicateError)
|
|
554
554
|
this.storeTransactionAsProblem(trx, "error:" + error.errno);
|
|
555
|
-
if (request.throwable)
|
|
556
|
-
|
|
555
|
+
if (request.throwable) {
|
|
556
|
+
const base = error.isDuplicateError ? DefaultErrors_1.default.DB_DUPLICATE_ERROR : DefaultErrors_1.default.DB_ERROR;
|
|
557
|
+
throw { ...base, details: error.message, stack: error };
|
|
558
|
+
}
|
|
557
559
|
return {
|
|
558
560
|
data: null,
|
|
559
561
|
error: error,
|
|
@@ -15,6 +15,7 @@ class DefaultErrors {
|
|
|
15
15
|
static TIMEOUT = { code: 9, message: "Timeout", httpStatus: 408 };
|
|
16
16
|
static METHOD_NOT_ALLOWED = { code: 10, message: "Method not allowed", httpStatus: 405 };
|
|
17
17
|
static DB_ERROR = { code: 11, message: "DB error", httpStatus: 500 };
|
|
18
|
+
static DB_DUPLICATE_ERROR = { code: 28, message: "DB duplicate entry", httpStatus: 409 };
|
|
18
19
|
static FORBIDDEN = { code: 12, message: "Forbidden", httpStatus: 403 };
|
|
19
20
|
static NOT_FOUND = { code: 13, message: "Not found", httpStatus: 404 };
|
|
20
21
|
static INTERNAL_SERVER_ERROR = { code: 14, message: "Internal server error.", httpStatus: 500 };
|