commit f1e50f72a2b59619136d4c93ef04703bc1d968b6 parent d4f1261382115ea471869431a835c80050cd7d07 Author: Christian Grothoff <christian@grothoff.org> Date: Tue, 29 Sep 2026 18:26:37 +0200 beekeeper: add a registry of Beekeeper's error codes Beekeeper returns Taler-style errors but is not part of GNU Taler, so its codes get their own registry, in 100000-110000, well clear of Taler's. Diffstat:
22 files changed, 442 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile @@ -1,7 +1,8 @@ # Minimal makefile for Sphinx documentation # -REGISTRIES = dot-alt \ +REGISTRIES = beekeeper-error-codes \ + dot-alt \ gnu-name-system-default-tlds \ gnu-name-system-record-flags \ gnu-name-system-record-types \ diff --git a/beekeeper-error-codes/.gitignore b/beekeeper-error-codes/.gitignore @@ -0,0 +1,3 @@ +# Generated (make); the *.tmp files and the .rst are ignored above. +*.rs +*.ts diff --git a/beekeeper-error-codes/Makefile b/beekeeper-error-codes/Makefile @@ -0,0 +1,61 @@ +FILES=beekeeper_error_codes.rs \ + beekeeper_error_codes.ts \ + beekeeper_error_codes.rst + +all: check $(FILES) + +check: registry.rec + recfix --check registry.rec + +distclean: + rm -f *.tmp + +clean: + rm -f $(FILES) *.tmp + +prep: + cd ../http-status-codes; make ; cd - + +# See ../gnu-taler-error-codes/Makefile for why 'diff' guards combined.tmp. +combined.tmp: registry.rec prep + recsel -t BeekeeperErrorCode -j HttpStatus -p Description,Name,Value,HttpStatus,HttpStatus.Value,HttpStatus.Identifier ../http-status-codes/registry.rec registry.rec > combined.xtmp + if ! diff $@ combined.xtmp > /dev/null; then mv combined.xtmp $@; else rm combined.xtmp; fi + +combined-escaped.tmp: combined.tmp + sed 's/\\/\\\\/g; s/"/\\"/g' $^ > $@ + +beekeeper_error_codes.rs_enum.tmp: combined.tmp rs.enum_template + ../format.sh rs.enum_template < combined.tmp > $@ + +beekeeper_error_codes.rs_status.tmp: combined.tmp rs.status_template + ../format.sh rs.status_template < combined.tmp > $@ + +beekeeper_error_codes.rs_name.tmp: combined.tmp rs.name_template + ../format.sh rs.name_template < combined.tmp > $@ + +beekeeper_error_codes.rs_description.tmp: combined-escaped.tmp rs.description_template + ../format.sh rs.description_template < combined-escaped.tmp > $@ + +beekeeper_error_codes.rs_from.tmp: combined.tmp rs.from_template + ../format.sh rs.from_template < combined.tmp > $@ + +beekeeper_error_codes.rs: rs.header beekeeper_error_codes.rs_enum.tmp \ + rs.status beekeeper_error_codes.rs_status.tmp \ + rs.name beekeeper_error_codes.rs_name.tmp \ + rs.description beekeeper_error_codes.rs_description.tmp \ + rs.from beekeeper_error_codes.rs_from.tmp rs.footer + cat $^ > $@ + +beekeeper_error_codes.ts.tmp: combined.tmp ts.template + ../format.sh ts.template < combined.tmp > $@ + +beekeeper_error_codes.ts: ts.header beekeeper_error_codes.ts.tmp ts.footer + cat $^ > $@ + +beekeeper_error_codes.rst.tmp: combined.tmp rst.template + ../format.sh rst.template < combined.tmp > $@ + +beekeeper_error_codes.rst: rst.header beekeeper_error_codes.rst.tmp rst.footer + cat $^ > $@ + +.PHONY: check clean distclean prep diff --git a/beekeeper-error-codes/registry.rec b/beekeeper-error-codes/registry.rec @@ -0,0 +1,229 @@ +# -*- mode: rec -*- +# +# Registry for Beekeeper error codes +# +# Beekeeper (JSON forms and KYC media collection) returns these codes in +# the "code" field of its error responses, next to the generic codes +# (0-99) of the GNU Taler registry, which it uses for errors of the HTTP +# framework. Its values are kept apart from the Taler registry (0-9999) +# so that the two can never clash. +# +%rec: BeekeeperErrorCode +%key: Value +%singular: Value +%typedef: ValueRange_t range 100000 110000 +%type: Value ValueRange_t +%mandatory: Value +%typedef: Description_t regexp |^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\(\)\.,;!"':#`\/ -]*$| +%type: Description Description_t +%mandatory: Description +%typedef: Name_t regexp /^BEEKEEPER_[ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$/ +%type: Name Name_t +%unique: Name +%mandatory: Name +%singular: Name +%type: HttpStatus rec HttpStatusCode +%mandatory: HttpStatus +%sort: Value + +# 100000 - 100099: generic + +Value: 100000 +Name: BEEKEEPER_RATE_LIMITED +Description: Too many requests of this kind from this client. Retry after the time given in the Retry-After header. +HttpStatus: 429 + +Value: 100001 +Name: BEEKEEPER_PROOF_OF_WORK_INVALID +Description: The server requires a proof of work for this request, and it was missing, wrong or expired. Fetch a new puzzle and retry. +HttpStatus: 403 + +# 100100 - 100199: authentication + +Value: 100100 +Name: BEEKEEPER_ACCESS_TOKEN_UNKNOWN +Description: The access token of the personal link is unknown or was revoked, for example because a new link was issued. +HttpStatus: 401 + +Value: 100101 +Name: BEEKEEPER_SESSION_INVALID +Description: The session token is missing, expired or revoked. Create a new session. +HttpStatus: 401 + +Value: 100102 +Name: BEEKEEPER_OTP_WRONG +Description: The one-time code is wrong. +HttpStatus: 403 + +Value: 100103 +Name: BEEKEEPER_OTP_EXPIRED +Description: The one-time code has expired or has no attempts left. Request a new one. +HttpStatus: 409 + +Value: 100104 +Name: BEEKEEPER_ADMIN_LOGIN_FAILED +Description: The user name, password or TOTP code is wrong. +HttpStatus: 401 + +Value: 100105 +Name: BEEKEEPER_ADMIN_ROLE_MISSING +Description: The administrator account lacks the role required for this request. +HttpStatus: 403 + +# 100200 - 100299: forms + +Value: 100200 +Name: BEEKEEPER_FORM_UNKNOWN +Description: There is no such form, or it is not public. +HttpStatus: 404 + +Value: 100201 +Name: BEEKEEPER_FORM_INVALID +Description: The form definition failed the static checks. The problems are listed per JSON path. +HttpStatus: 400 + +Value: 100202 +Name: BEEKEEPER_FORM_RETIRED +Description: The form was retired and can no longer be assigned or started. +HttpStatus: 409 + +# 100300 - 100399: users, assignments and pages + +Value: 100300 +Name: BEEKEEPER_ASSIGNMENT_UNKNOWN +Description: There is no such assignment for this user. +HttpStatus: 404 + +Value: 100301 +Name: BEEKEEPER_ASSIGNMENT_STATE +Description: The request is not allowed in the current state of the assignment. +HttpStatus: 409 + +Value: 100302 +Name: BEEKEEPER_ASSIGNMENT_INCOMPLETE +Description: The assignment cannot be submitted because some visible pages do not pass their checks. +HttpStatus: 400 + +Value: 100303 +Name: BEEKEEPER_PAGE_UNKNOWN +Description: The form has no page with this identifier. +HttpStatus: 404 + +Value: 100304 +Name: BEEKEEPER_PAGE_HIDDEN +Description: The page is not visible with the current answers. +HttpStatus: 409 + +Value: 100305 +Name: BEEKEEPER_PAGE_INVALID +Description: The answers were saved as a draft, but the page did not pass its checks. The problems are listed per question. +HttpStatus: 400 + +Value: 100306 +Name: BEEKEEPER_QUESTION_UNKNOWN +Description: There is no such question on this page, or it does not support the requested operation. +HttpStatus: 404 + +Value: 100307 +Name: BEEKEEPER_USER_UNKNOWN +Description: There is no such user. +HttpStatus: 404 + +# 100400 - 100499: verification of contact data + +Value: 100400 +Name: BEEKEEPER_VERIFICATION_WRONG_CODE +Description: The verification code is wrong. +HttpStatus: 403 + +Value: 100401 +Name: BEEKEEPER_VERIFICATION_RATE_LIMITED +Description: Verification codes were requested too often for this user or address. +HttpStatus: 429 + +Value: 100402 +Name: BEEKEEPER_VERIFICATION_NOT_STARTED +Description: No verification code was sent for the current answer, or it has expired. +HttpStatus: 409 + +Value: 100403 +Name: BEEKEEPER_HELPER_FAILED +Description: The helper program that delivers e-mail, SMS or letters failed. +HttpStatus: 502 + +# 100500 - 100599: uploads, blobs and video challenges + +Value: 100500 +Name: BEEKEEPER_CHALLENGE_EXPIRED +Description: The recording answers a video challenge that has expired or was replaced by a newer one. +HttpStatus: 409 + +Value: 100501 +Name: BEEKEEPER_BLOB_UNKNOWN +Description: An answer refers to a file that this user has not uploaded. +HttpStatus: 400 + +Value: 100502 +Name: BEEKEEPER_BLOB_NOT_FOUND +Description: There is no such file. +HttpStatus: 404 + +Value: 100503 +Name: BEEKEEPER_UPLOAD_TOO_LARGE +Description: The upload is larger than the question or the server allows. +HttpStatus: 413 + +Value: 100504 +Name: BEEKEEPER_UPLOAD_TYPE +Description: The question does not accept files of this MIME type. +HttpStatus: 415 + +Value: 100505 +Name: BEEKEEPER_UPLOAD_UNKNOWN +Description: There is no such upload, or it has expired. +HttpStatus: 404 + +Value: 100506 +Name: BEEKEEPER_UPLOAD_OFFSET_MISMATCH +Description: The Upload-Offset of the request does not match the length received so far. +HttpStatus: 409 + +Value: 100507 +Name: BEEKEEPER_UPLOAD_CHECKSUM_MISMATCH +Description: The SHA-256 of the complete upload differs from the announced one, and the upload was discarded. The tus endpoint answers with its status 460 (Checksum Mismatch), which the HTTP status registry does not list. +HttpStatus: 409 + +Value: 100508 +Name: BEEKEEPER_SUBTITLES_INVALID +Description: The subtitles of a challenge recording are not a well-formed SRT file, or their cues do not match the actions, order, timing and instructions of the challenge. +HttpStatus: 400 + +Value: 100600 +Name: BEEKEEPER_OAUTH_CLIENT_UNKNOWN +Description: The OAuth2 client is unknown or disabled, or its secret is wrong. +HttpStatus: 401 + +Value: 100601 +Name: BEEKEEPER_OAUTH_PROCESS_UNKNOWN +Description: There is no such KYC process, or it has expired. +HttpStatus: 404 + +Value: 100602 +Name: BEEKEEPER_OAUTH_REQUEST_INVALID +Description: The authorization request does not match the client: wrong client_id, redirect_uri or response_type. +HttpStatus: 400 + +Value: 100603 +Name: BEEKEEPER_OAUTH_CODE_INVALID +Description: The authorization code is unknown, expired or was already used. +HttpStatus: 403 + +Value: 100604 +Name: BEEKEEPER_OAUTH_TOKEN_INVALID +Description: The access token is unknown or expired. +HttpStatus: 401 + +Value: 100605 +Name: BEEKEEPER_OAUTH_NOT_READY +Description: The KYC process is not finished yet: some assignments are neither accepted nor failed. +HttpStatus: 409 diff --git a/beekeeper-error-codes/rs.description b/beekeeper-error-codes/rs.description @@ -0,0 +1,6 @@ + } + } + + pub fn description(self) -> &'static str { + use ErrorCode::*; + match self { diff --git a/beekeeper-error-codes/rs.description_template b/beekeeper-error-codes/rs.description_template @@ -0,0 +1 @@ + {{Name}} => "{{Description}}", diff --git a/beekeeper-error-codes/rs.enum_template b/beekeeper-error-codes/rs.enum_template @@ -0,0 +1,2 @@ + /// {{Description}} + {{Name}} = {{Value}}, diff --git a/beekeeper-error-codes/rs.footer b/beekeeper-error-codes/rs.footer @@ -0,0 +1,4 @@ + _ => None, + } + } +} diff --git a/beekeeper-error-codes/rs.from b/beekeeper-error-codes/rs.from @@ -0,0 +1,7 @@ + } + } + + /// The code with this numeric value. + pub fn from_value(value: u32) -> Option<Self> { + use ErrorCode::*; + match value { diff --git a/beekeeper-error-codes/rs.from_template b/beekeeper-error-codes/rs.from_template @@ -0,0 +1 @@ + {{Value}} => Some({{Name}}), diff --git a/beekeeper-error-codes/rs.header b/beekeeper-error-codes/rs.header @@ -0,0 +1,31 @@ +/* + This file is part of Beekeeper + Copyright (C) 2026 Taler Systems SA + + Beekeeper is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + Beekeeper is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: LGPL3.0-or-later + + Note: the LGPL does not apply to all components of Beekeeper, + but it does apply to this file. + + This file is generated from GANA (beekeeper-error-codes); do not edit. +*/ + +/// Error codes of Beekeeper. Errors of the HTTP framework use the generic +/// codes of the GNU Taler registry instead. +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +#[allow(non_camel_case_types, dead_code)] +#[repr(u32)] +pub enum ErrorCode { diff --git a/beekeeper-error-codes/rs.name b/beekeeper-error-codes/rs.name @@ -0,0 +1,6 @@ + } + } + + pub fn name(self) -> &'static str { + use ErrorCode::*; + match self { diff --git a/beekeeper-error-codes/rs.name_template b/beekeeper-error-codes/rs.name_template @@ -0,0 +1 @@ + {{Name}} => "{{Name}}", diff --git a/beekeeper-error-codes/rs.status b/beekeeper-error-codes/rs.status @@ -0,0 +1,12 @@ +} + +impl ErrorCode { + /// The numeric value, as sent in the `code` field. + pub fn value(self) -> u32 { + self as u32 + } + + /// The HTTP status code this error is returned with. + pub fn status_code(self) -> u16 { + use ErrorCode::*; + match self { diff --git a/beekeeper-error-codes/rs.status_template b/beekeeper-error-codes/rs.status_template @@ -0,0 +1 @@ + {{Name}} => {{HttpStatus_Value}}, diff --git a/beekeeper-error-codes/rst.footer b/beekeeper-error-codes/rst.footer @@ -0,0 +1 @@ + diff --git a/beekeeper-error-codes/rst.header b/beekeeper-error-codes/rst.header @@ -0,0 +1,35 @@ +.. + This file is part of Beekeeper. + Copyright (C) 2026 Taler Systems SA + + Beekeeper is free software; you can redistribute it and/or modify it under the + terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2.1, or (at your option) any later version. + + Beekeeper is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + Beekeeper; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + + SPDX-License-Identifier: LGPL3.0-or-later + + Note: the LGPL does not apply to all components of Beekeeper, + but it does apply to this file. + +.. _beekeeper-error-codes: + +Beekeeper Error Codes +--------------------- + +Codes in the range 100000 to 110000, returned by Beekeeper next to the +generic codes of the GNU Taler registry. + +.. list-table:: + :header-rows: 1 + + * - Value + - Name + - HTTP status + - Description diff --git a/beekeeper-error-codes/rst.template b/beekeeper-error-codes/rst.template @@ -0,0 +1,4 @@ + * - {{Value}} + - {{Name}} + - {{HttpStatus_Value}} + - {{Description}} diff --git a/beekeeper-error-codes/ts.footer b/beekeeper-error-codes/ts.footer @@ -0,0 +1,2 @@ + +} diff --git a/beekeeper-error-codes/ts.header b/beekeeper-error-codes/ts.header @@ -0,0 +1,26 @@ +/* + This file is part of Beekeeper + Copyright (C) 2026 Taler Systems SA + + Beekeeper is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + Beekeeper is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: LGPL3.0-or-later + + Note: the LGPL does not apply to all components of Beekeeper, + but it does apply to this file. + + This file is generated from GANA (beekeeper-error-codes); do not edit. +*/ + +export enum BeekeeperErrorCode { diff --git a/beekeeper-error-codes/ts.template b/beekeeper-error-codes/ts.template @@ -0,0 +1,6 @@ + + /** + * {{Description}} + * Returned with an HTTP status code of #MHD_HTTP_{{HttpStatus_Identifier}} ({{HttpStatus_Value}}). + */ + {{Name}} = {{Value}}, diff --git a/registries.rst b/registries.rst @@ -4,6 +4,7 @@ Registries .. toctree:: :maxdepth: 1 + beekeeper-error-codes/beekeeper_error_codes.rst dot-alt/dot_alt.rst gnu-name-system-default-tlds/tlds.rst gnu-name-system-record-flags/gnu_name_system_record_flags.rst