prisma-error-formatter
Version:
A flexible and customizable Prisma error formatter for better error handling and user-friendly error messages in Prisma Client applications.
15 lines (14 loc) • 528 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatUnknownError = formatUnknownError;
function formatUnknownError(exception) {
const path = typeof (exception === null || exception === void 0 ? void 0 : exception.name) === "string"
? exception.name.toLowerCase()
: "internal";
return [
{
path,
message: (exception === null || exception === void 0 ? void 0 : exception.message) || "An unexpected error occurred.",
},
];
}