From 415ff6307fe379aa28f39dea27cd0f82b5c88e65 Mon Sep 17 00:00:00 2001 From: swithek <52840391+swithek@users.noreply.github.com> Date: Sun, 4 Oct 2026 20:25:18 +0200 Subject: [PATCH] move hook error codes to the appropriate dirs --- .../hooks/container-image-watcher/errors.ts | 7 ++++++ .../editor/hooks/github-tracking/errors.ts | 12 ++++++++++ .../components/editor/hooks/hook-errors.ts | 23 ++++++++----------- .../editor/hooks/url-watcher/errors.ts | 4 ++++ 4 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 web/app/components/editor/hooks/container-image-watcher/errors.ts create mode 100644 web/app/components/editor/hooks/github-tracking/errors.ts create mode 100644 web/app/components/editor/hooks/url-watcher/errors.ts diff --git a/web/app/components/editor/hooks/container-image-watcher/errors.ts b/web/app/components/editor/hooks/container-image-watcher/errors.ts new file mode 100644 index 00000000..02827874 --- /dev/null +++ b/web/app/components/editor/hooks/container-image-watcher/errors.ts @@ -0,0 +1,7 @@ +// the message key for each code core refuses a container image watcher +// hook with. +export const CONTAINER_IMAGE_WATCHER_ERROR_KEYS: Record = { + "document_hook.unauthorized": "editor.hooks.errors.codes.unauthorized", + "document_hook.image_not_found": "editor.hooks.errors.codes.image-not-found", + "document_hook.invalid_image": "editor.hooks.errors.codes.invalid-image", +} diff --git a/web/app/components/editor/hooks/github-tracking/errors.ts b/web/app/components/editor/hooks/github-tracking/errors.ts new file mode 100644 index 00000000..b4c27a21 --- /dev/null +++ b/web/app/components/editor/hooks/github-tracking/errors.ts @@ -0,0 +1,12 @@ +// the message key for each code core refuses a github tracking hook with. +export const GITHUB_TRACKING_ERROR_KEYS: Record = { + "document_hook.missing_installation": + "editor.hooks.errors.codes.missing-installation", + "document_hook.missing_repository": + "editor.hooks.errors.codes.missing-repository", + "document_hook.missing_branch": "editor.hooks.errors.codes.missing-branch", + "document_hook.tree_truncated": "editor.hooks.errors.codes.tree-truncated", + "document_hook.invalid_repository": + "editor.hooks.errors.codes.invalid-repository", + "document_hook.missing_paths": "editor.hooks.errors.codes.missing-paths", +} diff --git a/web/app/components/editor/hooks/hook-errors.ts b/web/app/components/editor/hooks/hook-errors.ts index f78de86c..5869e196 100644 --- a/web/app/components/editor/hooks/hook-errors.ts +++ b/web/app/components/editor/hooks/hook-errors.ts @@ -1,21 +1,16 @@ -// the message key for each code core refuses a hook write with. +import { CONTAINER_IMAGE_WATCHER_ERROR_KEYS } from "./container-image-watcher/errors" +import { GITHUB_TRACKING_ERROR_KEYS } from "./github-tracking/errors" +import { URL_WATCHER_ERROR_KEYS } from "./url-watcher/errors" + +// the message key for each code core refuses a hook write with. The codes +// listed here can come from a hook of any type. const HOOK_ERROR_KEYS: Record = { "document_hook.unconfigured": "editor.hooks.errors.codes.unconfigured", - "document_hook.missing_installation": - "editor.hooks.errors.codes.missing-installation", - "document_hook.missing_repository": - "editor.hooks.errors.codes.missing-repository", - "document_hook.missing_branch": "editor.hooks.errors.codes.missing-branch", - "document_hook.tree_truncated": "editor.hooks.errors.codes.tree-truncated", - "document_hook.unauthorized": "editor.hooks.errors.codes.unauthorized", - "document_hook.image_not_found": "editor.hooks.errors.codes.image-not-found", - "document_hook.invalid_url": "editor.hooks.errors.codes.invalid-url", - "document_hook.invalid_repository": - "editor.hooks.errors.codes.invalid-repository", - "document_hook.missing_paths": "editor.hooks.errors.codes.missing-paths", - "document_hook.invalid_image": "editor.hooks.errors.codes.invalid-image", "document_hook.upstream_unavailable": "editor.hooks.errors.codes.upstream-unavailable", + ...GITHUB_TRACKING_ERROR_KEYS, + ...CONTAINER_IMAGE_WATCHER_ERROR_KEYS, + ...URL_WATCHER_ERROR_KEYS, } // hookErrorMessage returns the message for the code core refused a hook diff --git a/web/app/components/editor/hooks/url-watcher/errors.ts b/web/app/components/editor/hooks/url-watcher/errors.ts new file mode 100644 index 00000000..3c796579 --- /dev/null +++ b/web/app/components/editor/hooks/url-watcher/errors.ts @@ -0,0 +1,4 @@ +// the message key for each code core refuses a url watcher hook with. +export const URL_WATCHER_ERROR_KEYS: Record = { + "document_hook.invalid_url": "editor.hooks.errors.codes.invalid-url", +}