@mui/x-internals
Version:
Utility functions for the MUI X packages (internal use only).
21 lines (20 loc) • 838 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.formatErrorMessage = formatErrorMessage;
/**
* WARNING: Don't import this directly. It's imported by the code generated by
* `@mui/internal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
* constructors to ensure the plugin works as expected. Supported patterns include:
* throw new Error('My message');
* throw new Error(`My message: ${foo}`);
* throw new Error(`My message: ${foo}` + 'another string');
* ...
*/
function formatErrorMessage(code, ...args) {
const url = new URL('https://mui.com/x/production-error');
url.searchParams.set('code', code.toString());
args.forEach(arg => url.searchParams.append('args[]', arg));
return `MUI X error #${code}; visit ${url} for the full message.`;
}