tweak-tools
Version:
Tweak your React projects until awesomeness
43 lines (42 loc) • 2.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TweakErrors = void 0;
var TweakErrors;
(function (TweakErrors) {
TweakErrors[TweakErrors["UNSUPPORTED_INPUT"] = 0] = "UNSUPPORTED_INPUT";
TweakErrors[TweakErrors["NO_COMPONENT_FOR_TYPE"] = 1] = "NO_COMPONENT_FOR_TYPE";
TweakErrors[TweakErrors["UNKNOWN_INPUT"] = 2] = "UNKNOWN_INPUT";
TweakErrors[TweakErrors["DUPLICATE_KEYS"] = 3] = "DUPLICATE_KEYS";
TweakErrors[TweakErrors["ALREADY_REGISTERED_TYPE"] = 4] = "ALREADY_REGISTERED_TYPE";
TweakErrors[TweakErrors["CLIPBOARD_ERROR"] = 5] = "CLIPBOARD_ERROR";
TweakErrors[TweakErrors["THEME_ERROR"] = 6] = "THEME_ERROR";
TweakErrors[TweakErrors["PATH_DOESNT_EXIST"] = 7] = "PATH_DOESNT_EXIST";
TweakErrors[TweakErrors["INPUT_TYPE_OVERRIDE"] = 8] = "INPUT_TYPE_OVERRIDE";
TweakErrors[TweakErrors["EMPTY_KEY"] = 9] = "EMPTY_KEY";
})(TweakErrors = exports.TweakErrors || (exports.TweakErrors = {}));
const ErrorList = {
[TweakErrors.UNSUPPORTED_INPUT]: (type, path) => [
`An input with type \`${type}\` input was found at path \`${path}\` but it's not supported yet.`,
],
[TweakErrors.NO_COMPONENT_FOR_TYPE]: (type, path) => [
`Type \`${type}\` found at path \`${path}\` can't be displayed in panel because no component supports it yet.`,
],
[TweakErrors.UNKNOWN_INPUT]: (path, value) => [`input at path \`${path}\` is not recognized.`, value],
[TweakErrors.DUPLICATE_KEYS]: (key, path, prevPath) => [
`Key \`${key}\` of path \`${path}\` already exists at path \`${prevPath}\`. Even nested keys need to be unique. Rename one of the keys.`,
],
[TweakErrors.ALREADY_REGISTERED_TYPE]: (type) => [
`Type ${type} has already been registered. You can't register a component with the same type.`,
],
[TweakErrors.CLIPBOARD_ERROR]: (value) => [`Error copying the value`, value],
[TweakErrors.THEME_ERROR]: (category, key) => [
`Error accessing the theme \`${category}.${key}\` value.`,
],
[TweakErrors.PATH_DOESNT_EXIST]: (path) => [
`Error getting the value at path \`${path}\`. There is probably an error in your \`render\` function.`,
],
[TweakErrors.INPUT_TYPE_OVERRIDE]: (path, type, wrongType) => [
`Input at path \`${path}\` already exists with type: \`${type}\`. Its type cannot be overridden with type \`${wrongType}\`.`,
],
[TweakErrors.EMPTY_KEY]: () => ['Keys can not be empty, if you want to hide a label use whitespace.'],
};