Skip to content

Commit

Permalink
add more categories
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Aug 9, 2023
1 parent 898e5ad commit 36a3543
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 21 deletions.
52 changes: 48 additions & 4 deletions code/lib/core-events/src/errors/client-errors.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,53 @@
import dedent from 'ts-dedent';
import { StorybookError } from './storybook-error';

/**
* If you can't find a suitable category for your error, create one
* based on the package name/file path of which the error is thrown.
* For instance:
* If it's from @storybook/client-logger, then CLIENT-LOGGER
* If it's from a package that is too broad, e.g. @storybook/ui in the manager package, then use a combination like UI_MANAGER
*/
export enum Category {
PREVIEW_API = 'PREVIEW_API',
MANAGER = 'MANAGER',
CLIENT_LOGGER = 'CLIENT-LOGGER',
CHANNELS = 'CHANNELS',
CORE_COMMON = 'CORE-COMMON',
CORE_EVENTS = 'CORE-EVENTS',
INSTRUMENTER = 'INSTRUMENTER',
UI_MANAGER = 'UI_MANAGER',
MANAGER_API = 'MANAGER-API',
PREVIEW = 'PREVIEW',
PREVIEW_API = 'PREVIEW-API',
REACT_DOM_SHIM = 'REACT-DOM-SHIM',
ROUTER = 'ROUTER',
THEMING = 'THEMING',
FRAMEWORK_ANGULAR = 'FRAMEWORK-ANGULAR',
FRAMEWORK_EMBER = 'FRAMEWORK-EMBER',
FRAMEWORK_HTML_VITE = 'FRAMEWORK-HTML-VITE',
FRAMEWORK_HTML_WEBPACK5 = 'FRAMEWORK-HTML-WEBPACK5',
FRAMEWORK_NEXTJS = 'FRAMEWORK-NEXTJS',
FRAMEWORK_PREACT_VITE = 'FRAMEWORK-PREACT-VITE',
FRAMEWORK_PREACT_WEBPACK5 = 'FRAMEWORK-PREACT-WEBPACK5',
FRAMEWORK_REACT_VITE = 'FRAMEWORK-REACT-VITE',
FRAMEWORK_REACT_WEBPACK5 = 'FRAMEWORK-REACT-WEBPACK5',
FRAMEWORK_SERVER_WEBPACK5 = 'FRAMEWORK-SERVER-WEBPACK5',
FRAMEWORK_SVELTE_VITE = 'FRAMEWORK-SVELTE-VITE',
FRAMEWORK_SVELTE_WEBPACK5 = 'FRAMEWORK-SVELTE-WEBPACK5',
FRAMEWORK_SVELTEKIT = 'FRAMEWORK-SVELTEKIT',
FRAMEWORK_VUE_VITE = 'FRAMEWORK-VUE-VITE',
FRAMEWORK_VUE_WEBPACK5 = 'FRAMEWORK-VUE-WEBPACK5',
FRAMEWORK_VUE3_VITE = 'FRAMEWORK-VUE3-VITE',
FRAMEWORK_VUE3_WEBPACK5 = 'FRAMEWORK-VUE3-WEBPACK5',
FRAMEWORK_WEB_COMPONENTS_VITE = 'FRAMEWORK-WEB-COMPONENTS-VITE',
FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = 'FRAMEWORK-WEB-COMPONENTS-WEBPACK5',
RENDERER_HTML = 'RENDERER-HTML',
RENDERER_PREACT = 'RENDERER-PREACT',
RENDERER_REACT = 'RENDERER-REACT',
RENDERER_SERVER = 'RENDERER-SERVER',
RENDERER_SVELTE = 'RENDERER-SVELTE',
RENDERER_VUE = 'RENDERER-VUE',
RENDERER_VUE3 = 'RENDERER-VUE3',
RENDERER_WEB_COMPONENTS = 'RENDERER-WEB-COMPONENTS',
}

export class MissingStoryAfterHmr extends StorybookError {
Expand All @@ -28,9 +72,9 @@ export class MissingStoryAfterHmr extends StorybookError {
}

export class ProviderDoesNotExtendBaseProvider extends StorybookError {
readonly category = Category.MANAGER;
readonly category = Category.UI_MANAGER;

readonly code = 2;
readonly code = 1;

readonly telemetry = true;

Expand Down
17 changes: 0 additions & 17 deletions code/lib/core-events/src/errors/manager-errors.ts

This file was deleted.

24 changes: 24 additions & 0 deletions code/lib/core-events/src/errors/server-errors.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
import dedent from 'ts-dedent';
import { StorybookError } from './storybook-error';

/**
* If you can't find a suitable category for your error, create one
* based on the package name/file path of which the error is thrown.
* For instance:
* If it's from @storybook/node-logger, then NODE-LOGGER
* If it's from a package that is too broad, e.g. @storybook/cli in the init command, then use a combination like CLI_INIT
*/
export enum Category {
CLI = 'CLI',
CLI_INIT = 'CLI_INIT',
CLI_AUTOMIGRATE = 'CLI_AUTOMIGRATE',
CLI_UPGRADE = 'CLI_UPGRADE',
CLI_ADD = 'CLI_ADD',
CODEMOD = 'CODEMOD',
CORE_SERVER = 'CORE-SERVER',
CSF_PLUGIN = 'CSF-PLUGIN',
CSF_TOOLS = 'CSF-TOOLS',
NODE_LOGGER = 'NODE-LOGGER',
TELEMETRY = 'TELEMETRY',
BUILDER_MANAGER = 'BUILDER-MANAGER',
BUILDER_VITE = 'BUILDER-VITE',
BUILDER_WEBPACK5 = 'BUILDER-WEBPACK5',
SOURCE_LOADER = 'SOURCE-LOADER',
POSTINSTALL = 'POSTINSTALL',
DOCS_TOOLS = 'DOCS-TOOLS',
CORE_WEBPACK = 'CORE-WEBPACK',
}

export class NxProjectDetectedError extends StorybookError {
Expand Down

0 comments on commit 36a3543

Please sign in to comment.