Command Palette

Search for a command to run...

Назад к скиллам
скилл № 47357

hoc-error-codes

The string an error carries so a caller can tell it apart from every other, in the form `Aaa.XBBB.CCC`. Use when adding an error, or when choosing a category…

БесплатноБез исполняемых скриптов
openreachtechот openreachtech★ 17 звёзд на GitHub

Установить hoc-error-codes в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Error Codes

An error code identifies a failure across every boundary it crosses — whatever raised it, the response that carried it, the client that matched it against a message, and the report someone reads afterwards. This convention settles what that string is.

Whether a failure is reported by returning null or by throwing is settled before this convention is reached; the errors convention settles it. What follows applies to a failure that arrives carrying a code.

Aaa reads the same wherever the code was raised; XBBB.CCC does not. What kind of failure it is holds across every server a project runs, while who raised it is spelled in the terms of the server that did — an operation for GraphQL, a request method for a REST API. So this file settles Aaa and the shape of the rest, and a detail file settles the rest itself.

Detail files

The code is a string

An error code is a string, never a number. It is matched for equality and never ordered or added to, it carries a letter in the middle, and its leading zeros are part of it — 001 and 1 are not the same code.

Unauthenticated: '102.X000.001'   // OK
Unauthenticated: 102000001        // NG — the operation letter is gone, and so are the leading zeros

The three parts of Aaa.XBBB.CCC

part what it says width
Aaa what kind of failure this is 3 digits
XBBB who raised it 1 letter + 3 digits
CCC which one of theirs it is 3 digits

The dots are what make the widths cheap. An unseparated code has to reserve enough digits for the largest count anyone will ever need, and every count it holds is then bounded by a decision taken before any of them were known. Separated, each part is read on its own, and a part that turns out too narrow widens without disturbing its neighbours.

A — standard or application

value what it covers
1 the framework's own errors, raised by the engine and the packages beneath a project
2 the application's own errors, raised by what the project itself writes

A project declares 2 codes and never declares a 1 code. The standard ones already exist below it: an application that redeclares one has two names for a failure the framework raises, and the client matching on the code cannot tell which of them it received.

aa — the category

The two digits below A sort the failure. They carry the same meaning under 1 and under 2, so a category is learned once and read in both: validation is 03 whether the framework raised it (103) or the application did (203).

aa category raised when
00 unknown nothing more specific applies
01 implementational the code itself is wrong — an abstract member reached without an override
02 access right unauthenticated, unauthorized, denied schema permission, banned
03 validational the input did not pass its check
04 database record the record needed was absent, or the state forbade the operation
05 external API a service outside this system failed or refused

Sort by what failed, not by what the caller should do about it. A credential that does not match is an access-right failure (02) even though the check ran inside a mutation, and a service outside the system is 05 even when the reason it refused was a permission of its own. The two readings part company exactly where it matters: the client decides what to show from the category, and a category assigned by the handling it expected makes that circular.

  • A category that does not fit is not a licence to invent one. The list above is the whole of what a server raises, and 00 exists for what none of the others describes. The bands below are the client's, and a server never reaches for one.

The client fills the categories from the top

A request can fail without the server ever running it. What is sent can be rejected before the request leaves, the network can drop it, and the response can arrive unparseable — failures the client raises on its own behalf, which still need codes, and which must not be mistakable for anything the server sent.

They take the same format, and the category is what tells them apart. The client fills aa from the top: the tens digit starts at 9 and drops to 8, then 7, as each band is used up, while the units inside a band count up from 0. Counting down is what keeps the client's categories from ever meeting the server's, which count up from 00.

  • A is still 1, because these are the client framework's own errors. A client raising a code of its own — one the frame
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/graphql-error-codes.md
  • references/restapi-error-codes.md

FAQ

Что делает скилл hoc-error-codes?

The string an error carries so a caller can tell it apart from every other, in the form `Aaa.XBBB.CCC`. Use when adding an error, or when choosing a category for a new failure. Declaring and throwing the code belong to each stack's own convention; whether a failure throws at all belongs to the errors convention.

Как установить скилл hoc-error-codes?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл hoc-error-codes запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить hoc-error-codes с