UNPKG

@golemio/pid

Version:
19 lines 936 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RepositoryUtils = void 0; const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors"); const sequelize_1 = require("@golemio/core/dist/shared/sequelize"); class RepositoryUtils { static mapSequelizeError(err, className, methodName) { if (err instanceof golemio_errors_1.GeneralError) { throw err; } if (err instanceof sequelize_1.ValidationError && err.errors?.length) { const mapped = err.errors.map((e) => `${e.message} (${e.value})`).join(", "); throw new golemio_errors_1.ValidationError(`Validation error in ${methodName}: ${mapped}`, className, err, undefined, "pid"); } throw new golemio_errors_1.GeneralError(`Error in ${methodName}`, className, err); } } exports.RepositoryUtils = RepositoryUtils; //# sourceMappingURL=RepositoryUtils.js.map