securityos/node_modules/next/dist/lib/is-error.js

44 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
default: null,
getProperError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
default: function() {
return isError;
},
getProperError: function() {
return getProperError;
}
});
const _isplainobject = require("../shared/lib/is-plain-object");
function isError(err) {
return typeof err === "object" && err !== null && "name" in err && "message" in err;
}
function getProperError(err) {
if (isError(err)) {
return err;
}
if (process.env.NODE_ENV === "development") {
// provide better error for case where `throw undefined`
// is called in development
if (typeof err === "undefined") {
return new Error("An undefined error was thrown, " + "see here for more info: https://nextjs.org/docs/messages/threw-undefined");
}
if (err === null) {
return new Error("A null error was thrown, " + "see here for more info: https://nextjs.org/docs/messages/threw-undefined");
}
}
return new Error((0, _isplainobject.isPlainObject)(err) ? JSON.stringify(err) : err + "");
}
//# sourceMappingURL=is-error.js.map