mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-20 04:26:28 +08:00
impr: add custom error codes to contracts and api doc (@fehmer) (#6976)
This commit is contained in:
parent
74e4dd7b2a
commit
5026f41954
2 changed files with 12 additions and 0 deletions
|
@ -3,6 +3,7 @@ import { z } from "zod";
|
|||
import {
|
||||
CommonResponses,
|
||||
meta,
|
||||
MonkeyClientError,
|
||||
MonkeyResponseSchema,
|
||||
responseWithData,
|
||||
} from "./util/api";
|
||||
|
@ -131,6 +132,13 @@ export const resultsContract = c.router(
|
|||
body: AddResultRequestSchema.strict(),
|
||||
responses: {
|
||||
200: AddResultResponseSchema,
|
||||
460: MonkeyClientError.describe("Test too short"),
|
||||
461: MonkeyClientError.describe("Result hash invalid"),
|
||||
462: MonkeyClientError.describe("Result spacing invalid"),
|
||||
463: MonkeyClientError.describe("Result data invalid"),
|
||||
464: MonkeyClientError.describe("Missing key data"),
|
||||
465: MonkeyClientError.describe("Bot detected"),
|
||||
466: MonkeyClientError.describe("Duplicate result"),
|
||||
},
|
||||
metadata: meta({
|
||||
rateLimit: "resultsAdd",
|
||||
|
|
|
@ -120,6 +120,10 @@ export const CommonResponses = {
|
|||
403: MonkeyClientError.describe("Operation not permitted"),
|
||||
422: MonkeyValidationErrorSchema.describe("Request validation failed"),
|
||||
429: MonkeyClientError.describe("Rate limit exceeded"),
|
||||
470: MonkeyClientError.describe("Invalid ApeKey"),
|
||||
471: MonkeyClientError.describe("ApeKey is inactive"),
|
||||
472: MonkeyClientError.describe("ApeKey is malformed"),
|
||||
479: MonkeyClientError.describe("ApeKey rate limit exceeded"),
|
||||
500: MonkeyServerError.describe("Generic server error"),
|
||||
503: MonkeyServerError.describe(
|
||||
"Endpoint disabled or server is under maintenance"
|
||||
|
|
Loading…
Add table
Reference in a new issue