Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(api): return every error as JSON with a stable code

Andrej6c5f26e47bdb
diff --git a/apps/api/src/activity/index.ts b/apps/api/src/activity/index.ts
index 39366f8e0..d984fe34b 100644
--- a/apps/api/src/activity/index.ts
+++ b/apps/api/src/activity/index.ts
@@ -5,7 +5,6 @@ import {
createRoute,
errorResponse,
jsonResponse,
- z,
} from "../openapi";
import { requireWorkspacePermission } from "../utils/require-workspace-permission";
import { workspaceAccess } from "../utils/workspace-access-middleware";
@@ -94,14 +93,9 @@ const createActivityRoute = createRoute({
},
responses: {
200: jsonResponse("The created activity", activitySchema),
- 400: {
- description:
- "Invalid body, unknown task, or comment activity submitted through the generic endpoint",
- content: {
- "text/plain": { schema: z.string() },
- "application/json": { schema: z.object({ message: z.string() }) },
- },
- },
+ 400: errorResponse(
+ "Invalid body, unknown task, or comment activity submitted through the generic endpoint",
+ ),
403: errorResponse(
"No workspace access, or missing task:update permission",
),
@@ -203,10 +197,7 @@ const activity = apiRouter()
const { taskId, message, type, eventData } = c.req.valid("json");
if (type === "comment") {
throw new HTTPException(400, {
- res: c.json(
- { message: "Use the comment endpoint to create comments" },
- 400,
- ),
+ message: "Use the comment endpoint to create comments",
});
}
return c.json(
diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.ts
index 8db7da4e2..4efd4cc04 100644
--- a/apps/api/src/auth.ts
+++ b/apps/api/src/auth.ts
@@ -475,7 +475,10 @@ export const auth = betterAuth({
beforeCreateOrganization: async ({ organization }) => {
const check = checkWorkspaceName(organization.name ?? "");
if (!check.ok) {
- throw new APIError("BAD_REQUEST", { message: check.reason });
+ throw new APIError("BAD_REQUEST", {
+ code: "INVALID_WORKSPACE_NAME",
+ message: check.reason,
+ });
}
},
afterCreateOrganization: async ({ organization, user }) => {
@@ -525,6 +528,7 @@ export const auth = betterAuth({
const billable = await findBillableWorkspaces([organization.id]);
if (billable.length > 0) {
throw new APIError("CONFLICT", {
+ code: "WORKSPACE_HAS_ACTIVE_SUBSCRIPTION",
message: formatBillableWorkspacesMessage(
billable.map((workspace) => workspace.name),
),
@@ -773,6 +777,7 @@ export const auth = betterAuth({
if (isLoginFormDisabled && isLocalSignInPath(ctx.path)) {
throw new APIError("FORBIDDEN", {
+ code: "LOCAL_SIGN_IN_DISABLED",
message:
"Local sign-in is disabled. Please use a configured social or OIDC sign-in method.",
});
@@ -780,6 +785,7 @@ export const auth = betterAuth({
if (ctx.path === "/request-password-reset" && !isSmtpConfigured()) {
throw new APIError("FORBIDDEN", {
+ code: "EMAIL_DELIVERY_NOT_CONFIGURED",
message: "Password reset requires email delivery to be configured.",
});
}
@@ -793,7 +799,10 @@ export const auth = betterAuth({
ctx.headers?.get("x-turnstile-token") ?? ctx.body?.turnstileToken,
);
if (!verdict.ok)
- throw new APIError("FORBIDDEN", { message: verdict.reason });
+ throw new APIError("FORBIDDEN", {
+ code: "CAPTCHA_FAILED",
+ message: verdict.reason,
+ });
}
// Block invite-member calls on cloud from anonymous users or to
@@ -812,12 +821,14 @@ export const auth = betterAuth({
| undefined;
if (sessionUser?.isAnonymous) {
throw new APIError("FORBIDDEN", {
+ code: "GUEST_INVITATIONS_NOT_ALLOWED",
message: "Guest accounts may not send workspace invitations.",
});
}
const inviteeEmail = (ctx.body?.email as string | undefined) ?? "";
if (inviteeEmail && isDisposableEmail(inviteeEmail)) {
throw new APIError("BAD_REQUEST", {
+ code: "DISPOSABLE_EMAIL_NOT_ALLOWED",
message:
"Invitations to disposable-email addresses are not allowed.",
});
@@ -838,6 +849,7 @@ export const auth = betterAuth({
if (ctx.path === "/sign-up/email") {
if (isPasswordRegistrationDisabled && !isInstanceAdminSetup) {
throw new APIError("FORBIDDEN", {
+ code: "PASSWORD_REGISTRATION_DISABLED",
message:
"Password registration is currently disabled. Please use a configured social or OIDC sign-in method.",
});
@@ -849,6 +861,7 @@ export const auth = betterAuth({
const signupEmail = (ctx.body?.email as string | undefined) ?? "";
if (signupEmail && isDisposableEmail(signupEmail)) {
throw new APIError("BAD_REQUEST", {
+ code: "DISPOSABLE_EMAIL_NOT_ALLOWED",
message:
"Sign-up with disposable email addresses is not allowed.",
});
@@ -874,6 +887,7 @@ export const auth = betterAuth({
const result = await checkRegistrationAllowed(email, invitationId);
if (!result.allowed) {
throw new APIError("FORBIDDEN", {
+ code: "REGISTRATION_NOT_ALLOWED",
message: result.reason,
});
}
diff --git a/apps/api/src/errors/api-error-schema.ts b/apps/api/src/errors/api-error-schema.ts
new file mode 100644
index 000000000..86f4e3e1f
--- /dev/null
+++ b/apps/api/src/errors/api-error-schema.ts
@@ -0,0 +1,38 @@
+import { z } from "@hono/zod-openapi";
+
+export const apiErrorSchema = z
+ .object({
+ message: z.string().openapi({
+ description: "Human-readable description of the error.",
+ example: "Task not found",
+ }),
+ code: z.string().openapi({
+ description:
+ "Stable UPPER_SNAKE_CASE code. Derived from the status unless a more specific code applies, such as VALIDATION_ERROR or MISSING_PERMISSION.",
+ example: "NOT_FOUND",
+ }),
+ issues: z
+ .array(
+ z.object({
+ path: z.string().openapi({
+ description:
+ "Dotted path to the invalid input, prefixed with the request part (body, query, params, header).",
+ example: "body.title",
+ }),
+ message: z.string().openapi({ example: "Required" }),
+ }),
+ )
+ .optional()
+ .openapi({
+ description: "Every validation issue, for VALIDATION_ERROR.",
+ }),
+ missingPermissions: z
+ .array(z.string())
+ .optional()
+ .openapi({
+ description:
+ "Permissions the caller lacks for this route, as resource:action, for MISSING_PERMISSION and API_KEY_SCOPE.",
+ example: ["task:update"],
+ }),
+ })
+ .openapi("ApiError");
diff --git a/apps/api/src/errors/api-error.ts b/apps/api/src/errors/api-error.ts
new file mode 100644
index 000000000..450bc4178
--- /dev/null
+++ b/apps/api/src/errors/api-error.ts
@@ -0,0 +1,24 @@
+import { HTTPException } from "hono/http-exception";
+import type { ContentfulStatusCode } from "hono/utils/http-status";
+
+export type ApiErrorIssue = { path: string; message: string };
+
+export type ApiErrorBody = {
+ message: string;
+ code: string;
+ issues?: ApiErrorIssue[];
+ missingPermissions?: string[];
+};
+
+export class ApiError extends HTTPException {
+ readonly code: string;
+ readonly issues?: ApiErrorIssue[];
+ readonly missingPermissions?: string[];
+
+ constructor(status: ContentfulStatusCode, body: ApiErrorBody) {
+ super(status, { message: body.message });
+ this.code = body.code;
+ this.issues = body.issues;
+ this.missingPermissions = body.missingPermissions;
+ }
+}
diff --git a/apps/api/src/errors/error-code.test.ts b/apps/api/src/errors/error-code.test.ts
new file mode 100644
index 000000000..e874d8771
--- /dev/null
+++ b/apps/api/src/errors/error-code.test.ts
@@ -0,0 +1,28 @@
+import { describe, expect, it } from "vite-plus/test";
+import { errorCodeForStatus } from "./error-code";
+
+describe("errorCodeForStatus", () => {
+ it.each([
+ [400, "BAD_REQUEST"],
+ [401, "UNAUTHORIZED"],
+ [402, "PAYMENT_REQUIRED"],
+ [403, "FORBIDDEN"],
+ [404, "NOT_FOUND"],
+ [408, "REQUEST_TIMEOUT"],
+ [409, "CONFLICT"],
+ [413, "PAYLOAD_TOO_LARGE"],
+ [414, "URI_TOO_LONG"],
+ [422, "UNPROCESSABLE_ENTITY"],
+ [429, "RATE_LIMITED"],
+ [500, "INTERNAL_SERVER_ERROR"],
+ [502, "BAD_GATEWAY"],
+ [503, "SERVICE_UNAVAILABLE"],
+ ])("maps %i to %s", (status, code) => {
+ expect(errorCodeForStatus(status)).toBe(code);
+ });
+
+ it("falls back to the numeric status for unmapped codes", () => {
+ expect(errorCodeForStatus(418)).toBe("HTTP_418");
+ expect(errorCodeForStatus(504)).toBe("HTTP_504");
+ });
+});
diff --git a/apps/api/src/errors/error-code.ts b/apps/api/src/errors/error-code.ts
new file mode 100644
index 000000000..384374d1c
--- /dev/null
+++ b/apps/api/src/errors/error-code.ts
@@ -0,0 +1,20 @@
+const STATUS_CODES: Record<number, string> = {
+ 400: "BAD_REQUEST",
+ 401: "UNAUTHORIZED",
+ 402: "PAYMENT_REQUIRED",
+ 403: "FORBIDDEN",
+ 404: "NOT_FOUND",
+ 408: "REQUEST_TIMEOUT",
+ 409: "CONFLICT",
+ 413: "PAYLOAD_TOO_LARGE",
+ 414: "URI_TOO_LONG",
+ 422: "UNPROCESSABLE_ENTITY",
+ 429: "RATE_LIMITED",
+ 500: "INTERNAL_SERVER_ERROR",
+ 502: "BAD_GATEWAY",
+ 503: "SERVICE_UNAVAILABLE",
+};
+
+export function errorCodeForStatus(status: number): string {
+ return STATUS_CODES[status] ?? `HTTP_${status}`;
+}
diff --git a/apps/api/src/errors/http-exception-response.test.ts b/apps/api/src/errors/http-exception-response.test.ts
new file mode 100644
index 000000000..617f6c219
--- /dev/null
+++ b/apps/api/src/errors/http-exception-response.test.ts
@@ -0,0 +1,98 @@
+import { HTTPException } from "hono/http-exception";
+import { describe, expect, it } from "vite-plus/test";
+import { ApiError } from "./api-error";
+import { httpExceptionResponse } from "./http-exception-response";
+
+describe("httpExceptionResponse", () => {
+ it("turns a plain HTTPException into JSON with a derived code", async () => {
+ const response = await httpExceptionResponse(
+ new HTTPException(404, { message: "Task not found" }),
+ );
+
+ expect(response.status).toBe(404);
+ expect(response.headers.get("content-type")).toContain("application/json");
+ expect(await response.json()).toEqual({
+ message: "Task not found",
+ code: "NOT_FOUND",
+ });
+ });
+
+ it("keeps the specific code and details of an ApiError", async () => {
+ const response = await httpExceptionResponse(
+ new ApiError(403, {
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["task:update"],
+ }),
+ );
+
+ expect(response.status).toBe(403);
+ expect(await response.json()).toEqual({
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["task:update"],
+ });
+ });
+
+ it("converts a text response body and keeps its headers", async () => {
+ const response = await httpExceptionResponse(
+ new HTTPException(429, {
+ res: new Response("Label deletion is busy; retry this request", {
+ status: 429,
+ headers: { "Retry-After": "1" },
+ }),
+ }),
+ );
+
+ expect(response.status).toBe(429);
+ expect(response.headers.get("retry-after")).toBe("1");
+ expect(response.headers.get("content-type")).toContain("application/json");
+ expect(await response.json()).toEqual({
+ message: "Label deletion is busy; retry this request",
+ code: "RATE_LIMITED",
+ });
+ });
+
+ it("standardizes a JSON response that carries a message", async () => {
+ const response = await httpExceptionResponse(
+ new HTTPException(400, {
+ res: Response.json(
+ { message: "Use the comment endpoint" },
+ { status: 400 },
+ ),
+ }),
+ );
+
+ expect(await response.json()).toEqual({
+ message: "Use the comment endpoint",
+ code: "BAD_REQUEST",
+ });
+ });
+
+ it("passes an OAuth error response through untouched", async () => {
+ const original = Response.json(
+ { error: "temporarily_unavailable", error_description: "Retry later" },
+ { status: 429, headers: { "Retry-After": "60" } },
+ );
+ const response = await httpExceptionResponse(
+ new HTTPException(429, { res: original }),
+ );
+
+ expect(response).toBe(original);
+ expect(await response.json()).toEqual({
+ error: "temporarily_unavailable",
+ error_description: "Retry later",
+ });
+ });
+
+ it("falls back to a generic message for an empty body", async () => {
+ const response = await httpExceptionResponse(
+ new HTTPException(418, { res: new Response(null, { status: 418 }) }),
+ );
+
+ expect(await response.json()).toEqual({
+ message: "Request failed",
+ code: "HTTP_418",
+ });
+ });
+});
diff --git a/apps/api/src/errors/http-exception-response.ts b/apps/api/src/errors/http-exception-response.ts
new file mode 100644
index 000000000..62b841e3b
--- /dev/null
+++ b/apps/api/src/errors/http-exception-response.ts
@@ -0,0 +1,74 @@
+import type { HTTPException } from "hono/http-exception";
+import { ApiError, type ApiErrorBody } from "./api-error";
+import { errorCodeForStatus } from "./error-code";
+
+const FALLBACK_MESSAGE = "Request failed";
+
+type CustomBody = { message?: unknown; code?: unknown; error?: unknown };
+
+function parseCustomBody(text: string, contentType: string) {
+ if (!contentType.includes("json")) return null;
+ try {
+ const value: unknown = JSON.parse(text);
+ return value && typeof value === "object" && !Array.isArray(value)
+ ? (value as CustomBody)
+ : null;
+ } catch {
+ return null;
+ }
+}
+
+function errorBody(
+ error: HTTPException,
+ status: number,
+ message: string,
+ customCode?: unknown,
+): ApiErrorBody {
+ if (error instanceof ApiError) {
+ return {
+ message,
+ code: error.code,
+ ...(error.issues ? { issues: error.issues } : {}),
+ ...(error.missingPermissions
+ ? { missingPermissions: error.missingPermissions }
+ : {}),
+ };
+ }
+ return {
+ message,
+ code:
+ typeof customCode === "string" ? customCode : errorCodeForStatus(status),
+ };
+}
+
+export async function httpExceptionResponse(
+ error: HTTPException,
+): Promise<Response> {
+ const res = error.res;
+ if (!res) {
+ return Response.json(
+ errorBody(error, error.status, error.message || FALLBACK_MESSAGE),
+ { status: error.status },
+ );
+ }
+
+ const text = await res.clone().text();
+ const custom = parseCustomBody(text, res.headers.get("content-type") ?? "");
+ if (typeof custom?.error === "string") return res;
+
+ const customMessage =
+ typeof custom?.message === "string" ? custom.message : custom ? "" : text;
+ const headers = new Headers(res.headers);
+ headers.delete("content-type");
+ headers.delete("content-length");
+
+ return Response.json(
+ errorBody(
+ error,
+ res.status,
+ customMessage || error.message || FALLBACK_MESSAGE,
+ custom?.code,
+ ),
+ { status: res.status, headers },
+ );
+}
diff --git a/apps/api/src/errors/not-found-response.test.ts b/apps/api/src/errors/not-found-response.test.ts
new file mode 100644
index 000000000..fd0106b39
--- /dev/null
+++ b/apps/api/src/errors/not-found-response.test.ts
@@ -0,0 +1,31 @@
+import { describe, expect, it } from "vite-plus/test";
+import { withJsonNotFound } from "./not-found-response";
+
+describe("withJsonNotFound", () => {
+ it("turns an empty 404 into the standard JSON error", async () => {
+ const response = await withJsonNotFound(
+ new Response(null, { status: 404, statusText: "Not Found" }),
+ );
+
+ expect(response.status).toBe(404);
+ expect(await response.json()).toEqual({
+ message: "Not found",
+ code: "NOT_FOUND",
+ });
+ });
+
+ it("keeps a 404 that already has a body", async () => {
+ const original = Response.json(
+ { message: "Invitation not found", code: "INVITATION_NOT_FOUND" },
+ { status: 404 },
+ );
+
+ expect(await withJsonNotFound(original)).toBe(original);
+ });
+
+ it("keeps other responses", async () => {
+ const original = new Response(null, { status: 204 });
+
+ expect(await withJsonNotFound(original)).toBe(original);
+ });
+});
diff --git a/apps/api/src/errors/not-found-response.ts b/apps/api/src/errors/not-found-response.ts
new file mode 100644
index 000000000..132302c5b
--- /dev/null
+++ b/apps/api/src/errors/not-found-response.ts
@@ -0,0 +1,13 @@
+import { HTTPException } from "hono/http-exception";
+import { httpExceptionResponse } from "./http-exception-response";
+
+export function notFoundResponse() {
+ return httpExceptionResponse(
+ new HTTPException(404, { message: "Not found" }),
+ );
+}
+
+export async function withJsonNotFound(response: Response): Promise<Response> {
+ if (response.status !== 404 || response.body !== null) return response;
+ return notFoundResponse();
+}
diff --git a/apps/api/src/errors/validation-error.test.ts b/apps/api/src/errors/validation-error.test.ts
new file mode 100644
index 000000000..67fb453e3
--- /dev/null
+++ b/apps/api/src/errors/validation-error.test.ts
@@ -0,0 +1,55 @@
+import { describe, expect, it } from "vite-plus/test";
+import { ApiError } from "./api-error";
+import {
+ validationError,
+ validationHook,
+ validationHookWithMessage,
+} from "./validation-error";
+
+const issues = [
+ { path: ["title"], message: "Required" },
+ { path: ["limit"], message: "Too big" },
+];
+
+describe("validationHook", () => {
+ it("lets successful results through", () => {
+ expect(validationHook({ success: true, target: "json" })).toBeUndefined();
+ });
+
+ it("throws a VALIDATION_ERROR listing every issue", () => {
+ let thrown: unknown;
+ try {
+ validationHook({ success: false, target: "json", error: { issues } });
+ } catch (error) {
+ thrown = error;
+ }
+
+ expect(thrown).toBeInstanceOf(ApiError);
+ expect(thrown).toMatchObject({
+ status: 400,
+ message: "title: Required",
+ code: "VALIDATION_ERROR",
+ issues: [
+ { path: "body.title", message: "Required" },
+ { path: "body.limit", message: "Too big" },
+ ],
+ });
+ });
+
+ it("keeps a fixed message while reporting the issues", () => {
+ expect(() =>
+ validationHookWithMessage("Invalid description cursor")({
+ success: false,
+ target: "query",
+ error: { issues },
+ }),
+ ).toThrow("Invalid description cursor");
+ expect(validationError(issues, "query", "Fixed")).toMatchObject({
+ message: "Fixed",
+ issues: [
+ { path: "query.title", message: "Required" },
+ { path: "query.limit", message: "Too big" },
+ ],
+ });
+ });
+});
diff --git a/apps/api/src/errors/validation-error.ts b/apps/api/src/errors/validation-error.ts
new file mode 100644
index 000000000..74985c7f8
--- /dev/null
+++ b/apps/api/src/errors/validation-error.ts
@@ -0,0 +1,36 @@
+import { ApiError } from "./api-error";
+import {
+ formatValidationIssues,
+ type ValidationIssueInput,
+} from "./validation-issues";
+
+type ValidationResult = {
+ success: boolean;
+ target?: string;
+ error?: { issues: readonly ValidationIssueInput[] };
+};
+
+export function validationError(
+ issues: readonly ValidationIssueInput[],
+ target?: string,
+ message?: string,
+) {
+ const formatted = formatValidationIssues(issues, target);
+ return new ApiError(400, {
+ message: message ?? formatted.message,
+ code: "VALIDATION_ERROR",
+ issues: formatted.issues,
+ });
+}
+
+export function validationHook(result: ValidationResult): undefined {
+ if (result.success) return;
+ throw validationError(result.error?.issues ?? [], result.target);
+}
+
+export function validationHookWithMessage(message: string) {
+ return (result: ValidationResult): undefined => {
+ if (result.success) return;
+ throw validationError(result.error?.issues ?? [], result.target, message);
+ };
+}
diff --git a/apps/api/src/errors/validation-issues.test.ts b/apps/api/src/errors/validation-issues.test.ts
new file mode 100644
index 000000000..96bd64cef
--- /dev/null
+++ b/apps/api/src/errors/validation-issues.test.ts
@@ -0,0 +1,72 @@
+import { describe, expect, it } from "vite-plus/test";
+import { formatValidationIssues } from "./validation-issues";
+
+describe("formatValidationIssues", () => {
+ it("keeps the first issue as the message and lists every issue", () => {
+ expect(
+ formatValidationIssues(
+ [
+ { path: ["title"], message: "Required" },
+ { path: ["priority"], message: "Invalid option" },
+ { path: ["labels", 0, "name"], message: "Too long" },
+ ],
+ "json",
+ ),
+ ).toEqual({
+ message: "title: Required",
+ issues: [
+ { path: "body.title", message: "Required" },
+ { path: "body.priority", message: "Invalid option" },
+ { path: "body.labels.0.name", message: "Too long" },
+ ],
+ });
+ });
+
+ it.each([
+ ["query", "query.limit"],
+ ["param", "params.limit"],
+ ["form", "body.limit"],
+ ["header", "header.limit"],
+ ["cookie", "cookie.limit"],
+ ])("prefixes %s issues with the request part", (target, path) => {
+ expect(
+ formatValidationIssues([{ path: ["limit"], message: "Too big" }], target)
+ .issues,
+ ).toEqual([{ path, message: "Too big" }]);
+ });
+
+ it("leaves the path unprefixed when the request part is unknown", () => {
+ expect(
+ formatValidationIssues([{ path: ["limit"], message: "Too big" }]),
+ ).toEqual({
+ message: "limit: Too big",
+ issues: [{ path: "limit", message: "Too big" }],
+ });
+ });
+
+ it("names root issues after the request part", () => {
+ expect(
+ formatValidationIssues(
+ [{ path: [], message: "Expected object" }],
+ "json",
+ ),
+ ).toEqual({
+ message: "request: Expected object",
+ issues: [{ path: "body", message: "Expected object" }],
+ });
+ });
+
+ it("stringifies symbol path segments", () => {
+ expect(
+ formatValidationIssues([{ path: [Symbol("key")], message: "Bad" }])
+ .issues,
+ ).toEqual([{ path: "Symbol(key)", message: "Bad" }]);
+ });
+
+ it("describes an empty issue list", () => {
+ expect(formatValidationIssues([], "query")).toEqual({
+ message: "Invalid request",
+ issues: [],
+ });
+ });
+});
diff --git a/apps/api/src/errors/validation-issues.ts b/apps/api/src/errors/validation-issues.ts
new file mode 100644
index 000000000..0a8676b89
--- /dev/null
+++ b/apps/api/src/errors/validation-issues.ts
@@ -0,0 +1,41 @@
+import type { ApiErrorIssue } from "./api-error";
+
+export type ValidationIssueInput = {
+ path?: readonly PropertyKey[];
+ message?: string;
+};
+
+const TARGET_PREFIXES: Record<string, string> = {
+ json: "body",
+ form: "body",
+ query: "query",
+ param: "params",
+ header: "header",
+ cookie: "cookie",
+};
+
+function joinPath(segments: readonly PropertyKey[] | undefined) {
+ return (segments ?? []).map((segment) => String(segment)).join(".");
+}
+
+export function formatValidationIssues(
+ issues: readonly ValidationIssueInput[],
+ target?: string,
+): { message: string; issues: ApiErrorIssue[] } {
+ const prefix = target ? TARGET_PREFIXES[target] : undefined;
+ const first = issues[0];
+ const firstField = joinPath(first?.path);
+
+ return {
+ message: first
+ ? `${firstField || "request"}: ${first.message ?? "Invalid value"}`
+ : "Invalid request",
+ issues: issues.map((issue) => {
+ const field = joinPath(issue.path);
+ return {
+ path: [prefix, field].filter(Boolean).join("."),
+ message: issue.message ?? "Invalid value",
+ };
+ }),
+ };
+}
diff --git a/apps/api/src/gitea-integration/index.ts b/apps/api/src/gitea-integration/index.ts
index cace23655..6824cc330 100644
--- a/apps/api/src/gitea-integration/index.ts
+++ b/apps/api/src/gitea-integration/index.ts
@@ -33,7 +33,6 @@ import {
giteaIntegrationSchema,
giteaRepositoryListSchema,
giteaVerificationResultSchema,
- integrationNotFoundSchema,
} from "./response";
import {
createGiteaBody,
@@ -170,7 +169,7 @@ const updateIntegrationRoute = createRoute({
403: errorResponse(
"No workspace access, or missing workspace:manage_settings",
),
- 404: jsonResponse("Integration not found", integrationNotFoundSchema),
+ 404: errorResponse("Integration not found"),
409: errorResponse("Integration changed; refresh before updating settings"),
},
});
@@ -283,7 +282,7 @@ const giteaIntegration = apiRouter<BaseVariables & { workspaceId: string }>()
});
if (!row) {
- return c.json({ error: "Integration not found" }, 404);
+ throw new HTTPException(404, { message: "Integration not found" });
}
let config: GiteaConfig;
diff --git a/apps/api/src/gitea-integration/response.ts b/apps/api/src/gitea-integration/response.ts
index f88c8f9e8..2f52c34c4 100644
--- a/apps/api/src/gitea-integration/response.ts
+++ b/apps/api/src/gitea-integration/response.ts
@@ -79,7 +79,3 @@ export const giteaImportResultSchema = z
export const giteaDeleteResultSchema = z
.object({ success: z.boolean(), message: z.string() })
.openapi("GiteaDeleteResult");
-
-export const integrationNotFoundSchema = z
- .object({ error: z.string() })
- .openapi("GiteaIntegrationNotFound");
diff --git a/apps/api/src/github-integration/index.ts b/apps/api/src/github-integration/index.ts
index 182b4f759..03608e4ed 100644
--- a/apps/api/src/github-integration/index.ts
+++ b/apps/api/src/github-integration/index.ts
@@ -36,7 +36,6 @@ import {
githubIntegrationSchema,
githubRepositoryListSchema,
importResultSchema,
- integrationNotFoundSchema,
verificationResultSchema,
} from "./response";
import {
@@ -195,7 +194,7 @@ const updateIntegrationRoute = createRoute({
403: errorResponse(
"No workspace access, or missing workspace:manage_settings",
),
- 404: jsonResponse("Integration not found", integrationNotFoundSchema),
+ 404: errorResponse("Integration not found"),
},
});
@@ -334,7 +333,7 @@ const githubIntegration = apiRouter<BaseVariables & { workspaceId: string }>()
});
if (!row) {
- return c.json({ error: "Integration not found" }, 404);
+ throw new HTTPException(404, { message: "Integration not found" });
}
let config: GitHubConfig;
diff --git a/apps/api/src/github-integration/response.ts b/apps/api/src/github-integration/response.ts
index 842d0e7ae..88aa57af6 100644
--- a/apps/api/src/github-integration/response.ts
+++ b/apps/api/src/github-integration/response.ts
@@ -146,7 +146,3 @@ export const createdGithubIntegrationSchema = githubIntegrationSchema
export const deleteResultSchema = z
.object({ success: z.boolean(), message: z.string() })
.openapi("GitHubDeleteResult");
-
-export const integrationNotFoundSchema = z
- .object({ error: z.string() })
- .openapi("GitHubIntegrationNotFound");
diff --git a/apps/api/src/gitlab-integration/index.ts b/apps/api/src/gitlab-integration/index.ts
index 1b0e80b75..bf14dbe94 100644
--- a/apps/api/src/gitlab-integration/index.ts
+++ b/apps/api/src/gitlab-integration/index.ts
@@ -36,7 +36,6 @@ import {
gitlabIntegrationSchema,
gitlabProjectListSchema,
gitlabVerificationResultSchema,
- integrationNotFoundSchema,
} from "./response";
import {
createGitlabBody,
@@ -174,7 +173,7 @@ const updateIntegrationRoute = createRoute({
403: errorResponse(
"No workspace access, or missing workspace:manage_settings",
),
- 404: jsonResponse("Integration not found", integrationNotFoundSchema),
+ 404: errorResponse("Integration not found"),
409: errorResponse("Integration changed; refresh before updating settings"),
},
});
@@ -290,7 +289,7 @@ const gitlabIntegration = apiRouter<BaseVariables & { workspaceId: string }>()
});
if (!row) {
- return c.json({ error: "Integration not found" }, 404);
+ throw new HTTPException(404, { message: "Integration not found" });
}
let config: GitlabConfig;
diff --git a/apps/api/src/gitlab-integration/response.ts b/apps/api/src/gitlab-integration/response.ts
index bca701145..63e4bd4d9 100644
--- a/apps/api/src/gitlab-integration/response.ts
+++ b/apps/api/src/gitlab-integration/response.ts
@@ -85,7 +85,3 @@ export const gitlabImportResultSchema = z
export const gitlabDeleteResultSchema = z
.object({ success: z.boolean(), message: z.string() })
.openapi("GitlabDeleteResult");
-
-export const integrationNotFoundSchema = z
- .object({ error: z.string() })
- .openapi("GitlabIntegrationNotFound");
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index f9d94f44f..554f4df60 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -27,6 +27,16 @@ import comment from "./comment";
import config from "./config";
import customField from "./custom-field";
import db, { getDatabase, schema } from "./database";
+import { apiErrorSchema } from "./errors/api-error-schema";
+import { httpExceptionResponse } from "./errors/http-exception-response";
+import {
+ notFoundResponse,
+ withJsonNotFound,
+} from "./errors/not-found-response";
+import {
+ validationHook,
+ validationHookWithMessage,
+} from "./errors/validation-error";
import { prepareDatabaseStartup } from "./database/prepare-database-startup";
import { waitForDatabase } from "./database/wait-for-database";
import discordIntegration from "./discord-integration";
@@ -168,18 +178,29 @@ export function createApp() {
const app = new Hono<AppVariables>();
app.use("*", clientIpMiddleware());
- app.onError((err, c) => {
+ app.onError((err) => {
if (err instanceof HTTPException) {
// expected errors (401/404/...) are not reported; real failures are
if (err.status >= 500) {
Sentry.captureException(err);
}
- return err.getResponse();
+ return httpExceptionResponse(err);
}
Sentry.captureException(err);
- return c.json({ message: "Internal Server Error" }, 500);
+ return httpExceptionResponse(
+ new HTTPException(500, { message: "Internal Server Error" }),
+ );
+ });
+
+ app.notFound((c) => {
+ const path = c.req.path;
+ if (path === "/api" || path.startsWith("/api/")) {
+ return notFoundResponse();
+ }
+ return c.text("404 Not Found", 404);
});
+
const nodeWs = createNodeWebSocket({ app });
// node-ws exposes its ws server, but does not accept constructor options.
// Set the receiver limit before any connection can upgrade, including
@@ -229,7 +250,7 @@ export function createApp() {
// JSON with repeated keys compresses extremely well.
app.use(compress());
- const api = new OpenAPIHono<ApiVariables>();
+ const api = new OpenAPIHono<ApiVariables>({ defaultHook: validationHook });
api.get("/health", (c) => {
return c.json({ status: "ok" });
@@ -290,12 +311,7 @@ export function createApp() {
const project = await getPublicProject(id, c.req.valid("query"));
return c.json(project, 200);
},
- (result) => {
- if (!result.success)
- throw new HTTPException(400, {
- message: "Invalid task pagination or filters",
- });
- },
+ validationHookWithMessage("Invalid task pagination or filters"),
)
.openapi(
createRoute({
@@ -328,12 +344,7 @@ export function createApp() {
),
200,
),
- (result) => {
- if (!result.success)
- throw new HTTPException(400, {
- message: "Invalid description cursor",
- });
- },
+ validationHookWithMessage("Invalid description cursor"),
)
.openapi(
createRoute({
@@ -368,12 +379,7 @@ export function createApp() {
200,
);
},
- (result) => {
- if (!result.success)
- throw new HTTPException(400, {
- message: "Invalid description cursor",
- });
- },
+ validationHookWithMessage("Invalid description cursor"),
);
api.route("/calendar-feed", publicCalendarFeed);
@@ -443,8 +449,8 @@ export function createApp() {
content: { "*/*": { schema: { type: "string", format: "binary" } } },
},
304: { description: "Not modified" },
- 403: { description: "No access to this asset" },
- 404: { description: "Asset not found" },
+ 403: errorResponse("No access to this asset"),
+ 404: errorResponse("Asset not found"),
},
}),
async (c) => {
@@ -528,7 +534,7 @@ export function createApp() {
},
},
304: { description: "Not modified" },
- 404: { description: "Avatar not found" },
+ 404: errorResponse("Avatar not found"),
},
}),
async (c) => {
@@ -564,6 +570,7 @@ export function createApp() {
scheme: "bearer",
description: "API key or session token (Bearer)",
});
+ api.openAPIRegistry.register("ApiError", apiErrorSchema);
organizationRoutes(api.openAPIRegistry);
api.get("/openapi", (c) => {
@@ -618,6 +625,11 @@ export function createApp() {
}
operation.responses["401"] ??= {
description: "Missing or invalid credentials",
+ content: {
+ "application/json": {
+ schema: { $ref: "#/components/schemas/ApiError" },
+ },
+ },
};
}
}
@@ -687,7 +699,9 @@ export function createApp() {
// Preserve Better Auth bearer session tokens on auth routes.
if (session?.session && session.user) {
- return auth.handler(new Request(c.req.raw, { headers }));
+ return withJsonNotFound(
+ await auth.handler(new Request(c.req.raw, { headers })),
+ );
}
if (!(await verifyApiKey(bearerToken, { consume: false }))) {
@@ -697,10 +711,12 @@ export function createApp() {
// Better Auth API key plugin validates from x-api-key by default.
headers.set("x-api-key", bearerToken);
- return auth.handler(new Request(c.req.raw, { headers }));
+ return withJsonNotFound(
+ await auth.handler(new Request(c.req.raw, { headers })),
+ );
}
- return auth.handler(c.req.raw);
+ return withJsonNotFound(await auth.handler(c.req.raw));
});
api.route("/", mcpRoutes);
diff --git a/apps/api/src/openapi.ts b/apps/api/src/openapi.ts
index 392989137..28a1aac22 100644
--- a/apps/api/src/openapi.ts
+++ b/apps/api/src/openapi.ts
@@ -1,6 +1,7 @@
import { OpenAPIHono, z } from "@hono/zod-openapi";
import type { Session, User } from "better-auth/types";
-import { HTTPException } from "hono/http-exception";
+import { apiErrorSchema } from "./errors/api-error-schema";
+import { validationHook } from "./errors/validation-error";
export { createRoute } from "@hono/zod-openapi";
export { z };
@@ -23,19 +24,7 @@ export type BaseVariables = {
// createRoute({ middleware }) registers middleware BEFORE the request
// validators, so middleware must read the raw request, not c.req.valid().
export function apiRouter<V extends BaseVariables = BaseVariables>() {
- return new OpenAPIHono<{ Variables: V }>({
- defaultHook: (result) => {
- if (!result.success) {
- const issue = result.error.issues[0];
- const field = issue?.path.join(".");
- throw new HTTPException(400, {
- message: issue
- ? `${field || "request"}: ${issue.message}`
- : "Invalid request",
- });
- }
- },
- });
+ return new OpenAPIHono<{ Variables: V }>({ defaultHook: validationHook });
}
export const pagingNumber = (min: number, max: number, fallback?: number) => {
@@ -67,7 +56,7 @@ export const nullableResponseTimestamp = responseTimestamp
export function errorResponse(description: string) {
return {
description,
- content: { "text/plain": { schema: z.string() } },
+ content: { "application/json": { schema: apiErrorSchema } },
};
}
diff --git a/apps/api/src/project-access/resolve-invitation-project-access.ts b/apps/api/src/project-access/resolve-invitation-project-access.ts
index 2cd7021af..4c9dc50ee 100644
--- a/apps/api/src/project-access/resolve-invitation-project-access.ts
+++ b/apps/api/src/project-access/resolve-invitation-project-access.ts
@@ -14,10 +14,8 @@ export async function resolveInvitationProjectAccess(
});
if (!resolution.ok) {
- throw new APIError(
- resolution.status === 400 ? "BAD_REQUEST" : "FORBIDDEN",
- { message: resolution.message },
- );
+ const status = resolution.status === 400 ? "BAD_REQUEST" : "FORBIDDEN";
+ throw new APIError(status, { code: status, message: resolution.message });
}
return resolution.access;
diff --git a/apps/api/src/user/controllers/delete-account-data.ts b/apps/api/src/user/controllers/delete-account-data.ts
index 4b5347186..9d1fc0684 100644
--- a/apps/api/src/user/controllers/delete-account-data.ts
+++ b/apps/api/src/user/controllers/delete-account-data.ts
@@ -71,6 +71,7 @@ export async function deleteAccountData(userId: string) {
if (plan.blockedWorkspaceNames.length > 0) {
throw new APIError("CONFLICT", {
+ code: "SOLE_WORKSPACE_OWNER",
message: formatBlockedWorkspacesMessage(plan.blockedWorkspaceNames),
});
}
@@ -78,6 +79,7 @@ export async function deleteAccountData(userId: string) {
const billable = await findBillableWorkspaces(plan.workspaceIdsToDelete);
if (billable.length > 0) {
throw new APIError("CONFLICT", {
+ code: "WORKSPACE_HAS_ACTIVE_SUBSCRIPTION",
message: formatBillableWorkspacesMessage(
billable.map((workspace) => workspace.name),
),
diff --git a/apps/api/src/user/controllers/prepare-admin-user-removal.ts b/apps/api/src/user/controllers/prepare-admin-user-removal.ts
index 987483582..d509a1ab1 100644
--- a/apps/api/src/user/controllers/prepare-admin-user-removal.ts
+++ b/apps/api/src/user/controllers/prepare-admin-user-removal.ts
@@ -13,6 +13,7 @@ export async function prepareAdminUserRemoval(ctx: RemovalContext) {
if (!caller || !hasInstanceAdminRole(caller.role)) {
throw new APIError("FORBIDDEN", {
+ code: "INSTANCE_ADMIN_REQUIRED",
message: "Only instance administrators can remove users.",
});
}
@@ -24,6 +25,7 @@ export async function prepareAdminUserRemoval(ctx: RemovalContext) {
if (userId === caller.id) {
throw new APIError("BAD_REQUEST", {
+ code: "CANNOT_REMOVE_YOURSELF",
message: "You cannot remove yourself.",
});
}
diff --git a/apps/api/src/utils/missing-permissions.test.ts b/apps/api/src/utils/missing-permissions.test.ts
new file mode 100644
index 000000000..3aa76aeca
--- /dev/null
+++ b/apps/api/src/utils/missing-permissions.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it } from "vite-plus/test";
+import { missingPermissions } from "./missing-permissions";
+
+describe("missingPermissions", () => {
+ it("returns nothing when every required action is granted", () => {
+ expect(
+ missingPermissions(
+ { task: ["read", "update"], project: ["read"] },
+ { task: ["update"], project: ["read"] },
+ ),
+ ).toEqual([]);
+ });
+
+ it("lists each required action the statements lack", () => {
+ expect(
+ missingPermissions(
+ { task: ["read"] },
+ { task: ["read", "update", "delete"], project: ["create"] },
+ ),
+ ).toEqual(["task:update", "task:delete", "project:create"]);
+ });
+
+ it("treats missing statements as granting nothing", () => {
+ expect(missingPermissions(null, { task: ["create"] })).toEqual([
+ "task:create",
+ ]);
+ });
+
+ it("ignores grants the route does not require", () => {
+ expect(
+ missingPermissions(
+ { workspace: ["delete"], task: ["create"] },
+ { task: ["create"] },
+ ),
+ ).toEqual([]);
+ });
+});
diff --git a/apps/api/src/utils/missing-permissions.ts b/apps/api/src/utils/missing-permissions.ts
new file mode 100644
index 000000000..449b35fe8
--- /dev/null
+++ b/apps/api/src/utils/missing-permissions.ts
@@ -0,0 +1,13 @@
+export function missingPermissions(
+ statements: Record<string, readonly string[]> | null,
+ required: Record<string, readonly string[]>,
+): string[] {
+ const missing: string[] = [];
+ for (const [resource, actions] of Object.entries(required)) {
+ const granted = statements?.[resource];
+ for (const action of actions) {
+ if (!granted?.includes(action)) missing.push(`${resource}:${action}`);
+ }
+ }
+ return missing;
+}
diff --git a/apps/api/src/utils/registration-policy.ts b/apps/api/src/utils/registration-policy.ts
index 6da121f13..69490628f 100644
--- a/apps/api/src/utils/registration-policy.ts
+++ b/apps/api/src/utils/registration-policy.ts
@@ -24,6 +24,7 @@ export async function assertGuestRegistrationAllowed(): Promise<void> {
!(await hasRegisteredUsers())
) {
throw new APIError("FORBIDDEN", {
+ code: "GUEST_ACCESS_DISABLED",
message: "Guest access is unavailable on this instance.",
});
}
@@ -47,6 +48,7 @@ export async function assertUserRegistrationAllowed(
!isOAuthCallbackPath(context?.path)
) {
throw new APIError("FORBIDDEN", {
+ code: "LOCAL_REGISTRATION_DISABLED",
message:
"Local account registration is disabled. Please use a configured social or OIDC sign-in method.",
});
@@ -64,5 +66,8 @@ export async function assertUserRegistrationAllowed(
},
);
if (!result.allowed)
- throw new APIError("FORBIDDEN", { message: result.reason });
+ throw new APIError("FORBIDDEN", {
+ code: "REGISTRATION_NOT_ALLOWED",
+ message: result.reason,
+ });
}
diff --git a/apps/api/src/utils/require-user-session.ts b/apps/api/src/utils/require-user-session.ts
index cc6fa88e6..9abf9e570 100644
--- a/apps/api/src/utils/require-user-session.ts
+++ b/apps/api/src/utils/require-user-session.ts
@@ -1,10 +1,13 @@
import type { Context, Next } from "hono";
-import { HTTPException } from "hono/http-exception";
+import { ApiError } from "../errors/api-error";
/** Sensitive account operations cannot inherit the owner's privileges from an API key. */
export async function requireUserSession(c: Context, next: Next) {
if (c.get("apiKey") || !c.get("session") || !c.get("user")) {
- throw new HTTPException(403, { message: "A user session is required" });
+ throw new ApiError(403, {
+ message: "A user session is required",
+ code: "SESSION_REQUIRED",
+ });
}
c.header("Cache-Control", "no-store");
return next();
diff --git a/apps/api/src/utils/require-workspace-permission.ts b/apps/api/src/utils/require-workspace-permission.ts
index 96edd576d..601dd8397 100644
--- a/apps/api/src/utils/require-workspace-permission.ts
+++ b/apps/api/src/utils/require-workspace-permission.ts
@@ -3,7 +3,9 @@ import { and, eq } from "drizzle-orm";
import type { Context, Next } from "hono";
import { HTTPException } from "hono/http-exception";
import db, { schema } from "../database";
+import { ApiError } from "../errors/api-error";
import { isInstanceAdmin } from "./is-instance-admin";
+import { missingPermissions } from "./missing-permissions";
type PermissionMap = Record<string, string[]>;
@@ -119,8 +121,16 @@ export async function hasWorkspacePermission(
return true;
}
+ const statements = await memberStatements(c, workspaceId);
+ return Boolean(statements && satisfies(statements, permissions));
+}
+
+async function memberStatements(
+ c: Context,
+ workspaceId: string,
+): Promise<Record<string, readonly string[]> | null> {
const userId = c.get("userId");
- if (!userId) return false;
+ if (!userId) return null;
const [member] = await db
.select({ role: schema.workspaceUserTable.role })
@@ -133,7 +143,7 @@ export async function hasWorkspacePermission(
)
.limit(1);
- if (!member?.role) return false;
+ if (!member?.role) return null;
// Prefer the DB row when present so admin-edited defaults
// (viewer/member/admin) take effect immediately. Falls back to the
@@ -141,16 +151,16 @@ export async function hasWorkspacePermission(
// viewer/member/admin users from a 403 if their workspace somehow
// missed the seed (e.g., seed failed during workspace creation and
// the boot-time backfill hasn't run yet).
- const statements =
+ return (
(await customRoleStatements(workspaceId, member.role)) ??
- builtInRoleStatements(member.role);
-
- return Boolean(statements && satisfies(statements, permissions));
+ builtInRoleStatements(member.role)
+ );
}
export function requireWorkspacePermission(permissions: PermissionMap) {
return async (c: Context, next: Next) => {
- if (!c.get("workspaceId")) {
+ const workspaceId = c.get("workspaceId");
+ if (!workspaceId) {
throw new HTTPException(500, {
message: "workspaceId not set in context",
});
@@ -160,14 +170,28 @@ export function requireWorkspacePermission(permissions: PermissionMap) {
| { permissions?: Record<string, string[]> | null }
| undefined;
if (apiKey?.permissions && !satisfies(apiKey.permissions, permissions)) {
- throw new HTTPException(403, { message: "Insufficient API key scope" });
+ throw new ApiError(403, {
+ message: "Insufficient API key scope",
+ code: "API_KEY_SCOPE",
+ missingPermissions: missingPermissions(apiKey.permissions, permissions),
+ });
+ }
+
+ if (await isInstanceAdmin(c)) {
+ return next();
}
- if (!(await hasWorkspacePermission(c, permissions))) {
- if (!c.get("userId")) {
- throw new HTTPException(401, { message: "Unauthorized" });
- }
- throw new HTTPException(403, { message: "Insufficient permissions" });
+ if (!c.get("userId")) {
+ throw new HTTPException(401, { message: "Unauthorized" });
+ }
+
+ const statements = await memberStatements(c, workspaceId);
+ if (!statements || !satisfies(statements, permissions)) {
+ throw new ApiError(403, {
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: missingPermissions(statements, permissions),
+ });
}
return next();
diff --git a/apps/docs/api-reference/errors.mdx b/apps/docs/api-reference/errors.mdx
new file mode 100644
index 000000000..01a465fb0
--- /dev/null
+++ b/apps/docs/api-reference/errors.mdx
@@ -0,0 +1,99 @@
+---
+title: "Errors"
+description: "Read the JSON error body, branch on stable codes, and handle the OAuth exceptions."
+---
+
+Every error from `/api/*` is JSON with `Content-Type: application/json`:
+
+```json
+{
+ "message": "Insufficient permissions",
+ "code": "MISSING_PERMISSION",
+ "missingPermissions": ["task:create"]
+}
+```
+
+| Field | Always present | Description |
+| --- | --- | --- |
+| `message` | Yes | Human-readable text. Show it to people; do not parse it. |
+| `code` | Yes | Stable `UPPER_SNAKE_CASE` code. Branch on this instead of the message. |
+| `issues` | No | Every invalid input, for `VALIDATION_ERROR`. |
+| `missingPermissions` | No | The permissions the route requires that the caller lacks, for `MISSING_PERMISSION` and `API_KEY_SCOPE`. |
+
+The HTTP status stays meaningful on its own. New fields may be added, so ignore ones you do not recognize.
+
+## Codes from the status
+
+Most errors carry a code derived from their status:
+
+| Status | Code |
+| --- | --- |
+| 400 | `BAD_REQUEST` |
+| 401 | `UNAUTHORIZED` |
+| 402 | `PAYMENT_REQUIRED` |
+| 403 | `FORBIDDEN` |
+| 404 | `NOT_FOUND` |
+| 408 | `REQUEST_TIMEOUT` |
+| 409 | `CONFLICT` |
+| 413 | `PAYLOAD_TOO_LARGE` |
+| 414 | `URI_TOO_LONG` |
+| 422 | `UNPROCESSABLE_ENTITY` |
+| 429 | `RATE_LIMITED` |
+| 500 | `INTERNAL_SERVER_ERROR` |
+| 502 | `BAD_GATEWAY` |
+| 503 | `SERVICE_UNAVAILABLE` |
+| Any other | `HTTP_<status>`, for example `HTTP_504` |
+
+An unknown path under `/api` returns `404` with `{"message": "Not found", "code": "NOT_FOUND"}`. Unexpected server failures return `500` with `{"message": "Internal Server Error", "code": "INTERNAL_SERVER_ERROR"}` and never include internal details.
+
+## Specific codes
+
+| Code | Status | Meaning |
+| --- | --- | --- |
+| `VALIDATION_ERROR` | 400 | The path, query, or body failed validation. See `issues`. |
+| `MISSING_PERMISSION` | 403 | Your workspace role does not grant the action. `missingPermissions` lists what is missing, such as `task:update`. |
+| `API_KEY_SCOPE` | 403 | The API key was created with permissions that do not cover the action. `missingPermissions` lists what is missing. |
+| `SESSION_REQUIRED` | 403 | The endpoint needs a signed-in user session and does not accept API keys. This covers account-level actions such as billing, instance administration, and some GitHub setup routes. |
+
+`missingPermissions` only names permissions for the route you called in the workspace it targets.
+
+Sign-in, sign-up, and workspace membership endpoints under `/api/auth/*` return the same `message` and `code` fields. Their codes describe the specific failure, for example `INVALID_EMAIL_OR_PASSWORD`, `PASSWORD_REGISTRATION_DISABLED`, or `CAPTCHA_FAILED`.
+
+## Validation issues
+
+`message` repeats the first issue. `issues` lists all of them, so a form can mark every invalid field at once:
+
+```json
+{
+ "message": "title: Invalid input: expected string, received undefined",
+ "code": "VALIDATION_ERROR",
+ "issues": [
+ {
+ "path": "body.title",
+ "message": "Invalid input: expected string, received undefined"
+ },
+ {
+ "path": "body.priority",
+ "message": "Invalid option: expected one of \"no-priority\"|\"low\"|\"medium\"|\"high\"|\"urgent\""
+ }
+ ]
+}
+```
+
+Each `path` starts with the part of the request that failed: `body`, `query`, `params`, or `header`, followed by the field, for example `query.limit` or `body.customFields.0.value`.
+
+## Retrying
+
+A `429` may include a `Retry-After` header with the number of seconds to wait. Do not retry `4xx` errors other than `408` and `429` without changing the request.
+
+## Exceptions
+
+These endpoints follow external standards and keep their own error bodies:
+
+- **Device authorization.** `/api/auth/device/code` and `/api/auth/device/token` return RFC 8628 errors such as `{"error": "authorization_pending"}` and `{"error": "slow_down"}`. See [Authentication](/api-reference/authentication#poll-for-a-token).
+- **MCP OAuth.** `/api/mcp/register`, `/api/mcp/authorize`, `/api/mcp/authorize/request/{requestId}`, and `/api/mcp/token` return RFC 6749 and RFC 7591 errors shaped as `{"error": "invalid_request", "error_description": "..."}`. The `/api/mcp` endpoint itself answers with `{"error": ...}` bodies, such as `invalid_token`, and MCP protocol messages.
+- **Inbound webhooks.** The GitHub, Gitea, and GitLab webhook receivers are called by those services, not by API clients, and keep their existing responses.
+
+## Older instances
+
+Kaneo versions before this format returned many errors as plain text. If your client talks to instances you do not control, read the body as text and parse it as JSON only when it is valid, falling back to the text as the message.
diff --git a/apps/docs/api-reference/introduction.mdx b/apps/docs/api-reference/introduction.mdx
index e1bdc784d..f7986a4cc 100644
--- a/apps/docs/api-reference/introduction.mdx
+++ b/apps/docs/api-reference/introduction.mdx
@@ -56,7 +56,7 @@ For a single task, request `GET /api/task/TASK_ID`. Check the endpoint reference
| 429 | Rate limits; wait before retrying |
| 5xx | Instance logs and service health |
-Inspect the response body for the specific error. Do not retry a mutation blindly when you are unsure whether it already succeeded.
+Error bodies are JSON with a human-readable `message` and a stable `code`. See [Errors](/api-reference/errors) for the codes, validation issues, and missing permissions. Do not retry a mutation blindly when you are unsure whether it already succeeded.
## API reference
diff --git a/apps/docs/docs.json b/apps/docs/docs.json
index e21a0bfc9..37a24d3e8 100644
--- a/apps/docs/docs.json
+++ b/apps/docs/docs.json
@@ -172,6 +172,7 @@
"pages": [
"api-reference/introduction",
"api-reference/authentication",
+ "api-reference/errors",
"core/integrations/mcp-stateless"
]
},
diff --git a/apps/docs/openapi.json b/apps/docs/openapi.json
index b43605a8b..37e0e8212 100644
--- a/apps/docs/openapi.json
+++ b/apps/docs/openapi.json
@@ -25,6 +25,57 @@
}
},
"schemas": {
+ "ApiError": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string",
+ "description": "Human-readable description of the error.",
+ "example": "Task not found"
+ },
+ "code": {
+ "type": "string",
+ "description": "Stable UPPER_SNAKE_CASE code. Derived from the status unless a more specific code applies, such as VALIDATION_ERROR or MISSING_PERMISSION.",
+ "example": "NOT_FOUND"
+ },
+ "issues": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "path": {
+ "type": "string",
+ "description": "Dotted path to the invalid input, prefixed with the request part (body, query, params, header).",
+ "example": "body.title"
+ },
+ "message": {
+ "type": "string",
+ "example": "Required"
+ }
+ },
+ "required": [
+ "path",
+ "message"
+ ]
+ },
+ "description": "Every validation issue, for VALIDATION_ERROR."
+ },
+ "missingPermissions": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "Permissions the caller lacks for this route, as resource:action, for MISSING_PERMISSION and API_KEY_SCOPE.",
+ "example": [
+ "task:update"
+ ]
+ }
+ },
+ "required": [
+ "message",
+ "code"
+ ]
+ },
"InstanceStatus": {
"type": "object",
"properties": {
@@ -3008,17 +3059,6 @@
"requiresVerification"
]
},
- "GitHubIntegrationNotFound": {
- "type": "object",
- "properties": {
- "error": {
- "type": "string"
- }
- },
- "required": [
- "error"
- ]
- },
"GitHubDeleteResult": {
"type": "object",
"properties": {
@@ -3209,17 +3249,6 @@
"updatedAt"
]
},
- "GiteaIntegrationNotFound": {
- "type": "object",
- "properties": {
- "error": {
- "type": "string"
- }
- },
- "required": [
- "error"
- ]
- },
"GiteaDeleteResult": {
"type": "object",
"properties": {
@@ -3432,17 +3461,6 @@
"updatedAt"
]
},
- "GitlabIntegrationNotFound": {
- "type": "object",
- "properties": {
- "error": {
- "type": "string"
- }
- },
- "required": [
- "error"
- ]
- },
"GitlabDeleteResult": {
"type": "object",
"properties": {
@@ -4910,9 +4928,9 @@
"400": {
"description": "Invalid pagination or filters",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -4920,9 +4938,9 @@
"403": {
"description": "Project is not public",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -4930,9 +4948,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -4940,9 +4958,9 @@
"503": {
"description": "Task list request timed out",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5002,9 +5020,9 @@
"400": {
"description": "Invalid description cursor",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5012,9 +5030,9 @@
"404": {
"description": "Public project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5022,9 +5040,9 @@
"409": {
"description": "Description changed or no longer public",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5032,9 +5050,9 @@
"503": {
"description": "Description request timed out",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5102,9 +5120,9 @@
"400": {
"description": "Invalid description cursor",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5112,9 +5130,9 @@
"404": {
"description": "Public task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5122,9 +5140,9 @@
"409": {
"description": "Description changed or no longer public",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5132,9 +5150,9 @@
"503": {
"description": "Description request timed out",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5176,9 +5194,9 @@
"400": {
"description": "Invalid feed token",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5186,9 +5204,9 @@
"404": {
"description": "Calendar feed not found or revoked",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -5247,10 +5265,24 @@
"description": "Not modified"
},
"403": {
- "description": "No access to this asset"
+ "description": "No access to this asset",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"404": {
- "description": "Asset not found"
+ "description": "Asset not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5290,7 +5322,14 @@
"description": "Not modified"
},
"404": {
- "description": "Avatar not found"
+ "description": "Avatar not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5367,7 +5406,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5444,7 +5490,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5481,7 +5534,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5518,7 +5578,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5591,7 +5658,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5646,7 +5720,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5723,7 +5804,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5767,7 +5855,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5832,7 +5927,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5877,7 +5979,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5895,7 +6004,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -5918,7 +6034,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6014,7 +6137,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6032,7 +6162,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6093,7 +6230,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6241,7 +6385,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"502": {
"description": "Invitation saved, but email delivery failed",
@@ -6303,7 +6454,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6329,7 +6487,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6420,7 +6585,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6438,7 +6610,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6456,7 +6635,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6508,7 +6694,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6565,7 +6758,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6641,7 +6841,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6667,11 +6874,18 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
- }
- }
- }
- },
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/auth/organization/reject-invitation": {
"post": {
"tags": [
@@ -6724,7 +6938,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6800,7 +7021,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6860,7 +7088,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6925,7 +7160,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -6971,7 +7213,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -7013,7 +7262,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -7086,7 +7342,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -7177,7 +7440,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -7262,7 +7532,14 @@
"description": "Success"
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -7356,7 +7633,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -7748,7 +8032,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -7804,9 +8095,9 @@
"400": {
"description": "Invalid destination or same workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -7814,9 +8105,9 @@
"401": {
"description": "Unauthorized",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -7824,9 +8115,9 @@
"402": {
"description": "Destination workspace plan has expired",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -7834,9 +8125,9 @@
"403": {
"description": "Missing workspace access or permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -7844,9 +8135,9 @@
"404": {
"description": "Project not found in the source workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -7854,9 +8145,9 @@
"409": {
"description": "Project key conflict or cross-project task relationships",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -7909,22 +8200,29 @@
"400": {
"description": "Workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -7982,22 +8280,29 @@
"400": {
"description": "Invalid body, or workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:create permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8005,9 +8310,9 @@
"409": {
"description": "Another project in the workspace uses this key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8047,22 +8352,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8134,22 +8446,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, missing project:update, or missing project:share when visibility changes",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8157,9 +8476,9 @@
"409": {
"description": "Another project in the workspace uses the new key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8197,22 +8516,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:delete permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8256,22 +8582,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8279,9 +8612,9 @@
"404": {
"description": "Project background not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8312,22 +8645,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8405,22 +8745,29 @@
"400": {
"description": "Invalid body, or workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, missing project:update permission, or no access to a listed project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8460,22 +8807,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8515,22 +8869,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8538,9 +8899,9 @@
"409": {
"description": "Another project in the workspace uses this key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8602,22 +8963,29 @@
"400": {
"description": "Invalid image upload request, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8625,9 +8993,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8635,9 +9003,9 @@
"503": {
"description": "Image uploads are not configured",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8707,22 +9075,29 @@
"400": {
"description": "Invalid image upload request, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8730,9 +9105,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8740,9 +9115,9 @@
"500": {
"description": "Failed to save the project background",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8785,9 +9160,9 @@
"400": {
"description": "Invalid request or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8795,9 +9170,9 @@
"401": {
"description": "Authentication required",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8805,9 +9180,9 @@
"403": {
"description": "No workspace access or missing project sharing permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8871,9 +9246,9 @@
"400": {
"description": "Invalid request or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8881,9 +9256,9 @@
"401": {
"description": "Authentication required",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8891,9 +9266,9 @@
"403": {
"description": "No workspace access, missing project:share permission, or missing label:create permission for a new workspace label definition",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8949,9 +9324,9 @@
"400": {
"description": "Invalid request or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8959,9 +9334,9 @@
"401": {
"description": "Authentication required",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8969,9 +9344,9 @@
"403": {
"description": "No workspace access or missing project sharing permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -8979,9 +9354,9 @@
"404": {
"description": "Calendar feed not found in this project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9040,22 +9415,29 @@
"400": {
"description": "Invalid offset or version",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9063,9 +9445,9 @@
"404": {
"description": "Task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9073,9 +9455,9 @@
"409": {
"description": "Description changed; reload from offset zero",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9083,9 +9465,9 @@
"503": {
"description": "Description request timed out",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9144,22 +9526,29 @@
"400": {
"description": "Invalid search query or cursor",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9167,9 +9556,9 @@
"503": {
"description": "Description search timed out",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9224,22 +9613,29 @@
"400": {
"description": "Invalid workspace ID or query parameters",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:read or task:read permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9377,22 +9773,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9400,9 +9803,9 @@
"503": {
"description": "Task list request timed out",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9474,22 +9877,29 @@
"400": {
"description": "Invalid body, or the tasks span more than one workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing the permission the operation needs",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9497,9 +9907,9 @@
"404": {
"description": "No tasks found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9507,9 +9917,9 @@
"409": {
"description": "Tasks changed projects; retry the operation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9582,22 +9992,29 @@
"400": {
"description": "Invalid upload",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Missing task:create permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9605,9 +10022,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9615,9 +10032,9 @@
"503": {
"description": "Storage unavailable",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9694,22 +10111,29 @@
"400": {
"description": "Invalid upload",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Missing task:create permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9717,9 +10141,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9727,9 +10151,9 @@
"409": {
"description": "Upload already attached",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9737,9 +10161,9 @@
"503": {
"description": "Storage unavailable",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9859,22 +10283,29 @@
"400": {
"description": "Invalid positions or column",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9882,9 +10313,9 @@
"404": {
"description": "Tasks do not belong to the project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -9892,9 +10323,9 @@
"409": {
"description": "Board changed or task moved; refresh before reordering",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10007,22 +10438,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:create permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10077,9 +10515,9 @@
"400": {
"description": "Invalid task fields or request",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10087,9 +10525,9 @@
"401": {
"description": "Unauthorized",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10097,9 +10535,9 @@
"403": {
"description": "No workspace access, missing task:create, or missing task:update when copying parent links",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10107,9 +10545,9 @@
"404": {
"description": "Task or project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10117,9 +10555,9 @@
"409": {
"description": "Task column has reached its capacity",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10127,9 +10565,9 @@
"503": {
"description": "Unable to copy task attachments",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10206,22 +10644,29 @@
"400": {
"description": "Invalid ticket ID",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"404": {
"description": "No accessible task has this ticket ID",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10229,9 +10674,9 @@
"409": {
"description": "Ticket ID matches multiple accessible tasks",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10283,22 +10728,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the task's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10392,22 +10844,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update or task:assign permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10445,22 +10904,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:delete permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10468,9 +10934,9 @@
"409": {
"description": "Task changed projects; retry the operation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10532,22 +10998,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10555,9 +11028,9 @@
"404": {
"description": "Task or destination project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10565,9 +11038,9 @@
"409": {
"description": "Task or project moved concurrently; retry the move",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10607,22 +11080,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10719,22 +11199,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:create permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10792,22 +11279,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10872,22 +11366,29 @@
"400": {
"description": "Invalid priority, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10949,22 +11450,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:assign permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -10972,9 +11480,9 @@
"404": {
"description": "Assignee is not a member of the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11029,22 +11537,29 @@
"400": {
"description": "Invalid date, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11102,22 +11617,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11192,32 +11714,39 @@
"400": {
"description": "Unsupported content type, or the file is too large",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
- },
- "403": {
- "description": "No workspace access, or missing task:update permission",
+ "description": "Missing or invalid credentials",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
- "404": {
+ "403": {
+ "description": "No workspace access, or missing task:update permission",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
+ },
+ "404": {
"description": "Task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11225,9 +11754,9 @@
"503": {
"description": "Image uploads are not configured on this instance",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11307,22 +11836,29 @@
"400": {
"description": "Invalid upload, or the key does not belong to this task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11330,9 +11866,9 @@
"404": {
"description": "Task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11390,22 +11926,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11448,22 +11991,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11528,22 +12078,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11551,9 +12108,9 @@
"409": {
"description": "The slug is reserved, or already used in this project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11630,22 +12187,29 @@
"400": {
"description": "A column does not belong to this project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11715,22 +12279,29 @@
"400": {
"description": "Invalid body, or unknown column",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11768,22 +12339,29 @@
"400": {
"description": "Unknown column, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11791,9 +12369,9 @@
"409": {
"description": "The column still contains tasks",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11837,22 +12415,29 @@
"400": {
"description": "Workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:read or task:read permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11907,22 +12492,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the task's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -11991,35 +12583,29 @@
"400": {
"description": "Invalid body, unknown task, or comment activity submitted through the generic endpoint",
"content": {
- "text/plain": {
- "schema": {
- "type": "string"
- }
- },
"application/json": {
"schema": {
- "type": "object",
- "properties": {
- "message": {
- "type": "string"
- }
- },
- "required": [
- "message"
- ]
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12072,22 +12658,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12138,22 +12731,29 @@
"400": {
"description": "Invalid body, or unknown activity",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Not the author, or no access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12161,9 +12761,9 @@
"404": {
"description": "Comment not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12209,22 +12809,29 @@
"400": {
"description": "Invalid body, or unknown activity",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Not the author, or no access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12232,9 +12839,9 @@
"404": {
"description": "Comment not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12277,22 +12884,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the task's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12364,22 +12978,29 @@
"400": {
"description": "Invalid body, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, missing task:update permission, or external attribution without workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12439,22 +13060,29 @@
"400": {
"description": "Invalid body, or unknown comment",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Not the author, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12462,9 +13090,9 @@
"404": {
"description": "Comment not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12502,22 +13130,29 @@
"400": {
"description": "Unknown comment, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Not the author, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12525,9 +13160,9 @@
"404": {
"description": "Comment not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12570,22 +13205,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the task's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12625,22 +13267,29 @@
"400": {
"description": "Unknown entry, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the entry's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12706,22 +13355,29 @@
"400": {
"description": "Invalid timestamps, or unknown entry",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12784,22 +13440,29 @@
"400": {
"description": "Invalid timestamps, or unknown task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12842,22 +13505,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the task's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12900,22 +13570,29 @@
"400": {
"description": "Workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12974,22 +13651,29 @@
"400": {
"description": "Invalid body, or workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing label:create permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -12997,9 +13681,9 @@
"404": {
"description": "Task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13007,9 +13691,9 @@
"409": {
"description": "The workspace label is being deleted",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13049,22 +13733,29 @@
"400": {
"description": "Unknown label, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the label's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13124,22 +13815,29 @@
"400": {
"description": "Invalid body, or unknown label",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing label:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13147,9 +13845,9 @@
"409": {
"description": "The workspace label is being deleted",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13197,22 +13895,29 @@
"400": {
"description": "Unknown label, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing label:delete permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13220,9 +13925,9 @@
"404": {
"description": "The label's task no longer exists",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13230,9 +13935,9 @@
"429": {
"description": "Deletion capacity is busy; retry after Retry-After",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13290,22 +13995,29 @@
"400": {
"description": "Unknown label, or label and task belong to different workspaces",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing label:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13313,9 +14025,9 @@
"404": {
"description": "Task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13323,9 +14035,9 @@
"409": {
"description": "The workspace label is being deleted",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13363,22 +14075,29 @@
"400": {
"description": "Unknown label, or label is not assigned to a task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing label:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13386,9 +14105,9 @@
"404": {
"description": "Task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13432,7 +14151,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
},
@@ -13513,15 +14239,22 @@
"400": {
"description": "Invalid request",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -13556,14 +14289,21 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"404": {
"description": "Notification not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13604,7 +14344,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -13642,7 +14389,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -13667,7 +14421,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
},
@@ -13776,15 +14537,22 @@
"400": {
"description": "Invalid request",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -13870,22 +14638,29 @@
"400": {
"description": "Invalid request",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13921,14 +14696,21 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -13936,9 +14718,9 @@
"404": {
"description": "Workspace rule not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14032,22 +14814,29 @@
"400": {
"description": "Invalid query, or workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14109,22 +14898,29 @@
"400": {
"description": "Invalid rule or workspace label",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or required permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14132,9 +14928,9 @@
"404": {
"description": "Integration or linked task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14142,9 +14938,9 @@
"409": {
"description": "Configuration, impact or comparison changed; review again",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14330,22 +15126,29 @@
"400": {
"description": "Invalid rule or workspace label",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or required permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14353,9 +15156,9 @@
"404": {
"description": "Integration or linked task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14363,9 +15166,9 @@
"409": {
"description": "Configuration, impact or comparison changed; review again",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14547,22 +15350,29 @@
"400": {
"description": "Invalid rule or workspace label",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or required permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14570,9 +15380,9 @@
"404": {
"description": "Integration or linked task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14580,9 +15390,9 @@
"409": {
"description": "Configuration, impact or comparison changed; review again",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14644,22 +15454,29 @@
"400": {
"description": "Invalid rule or workspace label",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or required permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14667,9 +15484,9 @@
"404": {
"description": "Integration or linked task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14677,9 +15494,9 @@
"409": {
"description": "Configuration, impact or comparison changed; review again",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14687,9 +15504,9 @@
"502": {
"description": "External issue unavailable; sync remains paused",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14788,22 +15605,29 @@
"400": {
"description": "Invalid rule or workspace label",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or required permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14811,9 +15635,9 @@
"404": {
"description": "Integration or linked task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14821,9 +15645,9 @@
"409": {
"description": "Comparison changed or synchronization is busy; review or retry",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14831,9 +15655,9 @@
"502": {
"description": "External issue unavailable; sync remains paused",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14861,7 +15685,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -14918,22 +15749,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -14994,22 +15832,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15049,22 +15894,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15128,22 +15980,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15151,9 +16010,9 @@
"409": {
"description": "Integration changed or another repository is already linked",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15209,22 +16068,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15234,7 +16100,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/GitHubIntegrationNotFound"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15242,9 +16108,9 @@
"409": {
"description": "Integration changed or another repository is already linked",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15282,22 +16148,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15305,9 +16178,9 @@
"404": {
"description": "GitHub integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15372,22 +16245,29 @@
"400": {
"description": "projectId is required",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:create or task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15395,9 +16275,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15405,9 +16285,9 @@
"409": {
"description": "Integration or import changed; refresh before resuming",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15415,9 +16295,9 @@
"429": {
"description": "Import busy; retry after one second",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15425,9 +16305,9 @@
"502": {
"description": "Provider unavailable or invalid page; progress is saved",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15486,22 +16366,29 @@
"400": {
"description": "Invalid body, unknown project, or invalid Gitea credentials",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15570,9 +16457,9 @@
"400": {
"description": "Invalid body, unknown project, or invalid Gitea credentials",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15580,9 +16467,9 @@
"401": {
"description": "Kaneo authentication required",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15590,9 +16477,9 @@
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15600,9 +16487,9 @@
"500": {
"description": "Gitea verification failed",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15642,22 +16529,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15728,22 +16622,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15799,22 +16700,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15824,7 +16732,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/GiteaIntegrationNotFound"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15832,9 +16740,9 @@
"409": {
"description": "Integration changed; refresh before updating settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15872,22 +16780,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15895,9 +16810,9 @@
"404": {
"description": "Gitea integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15945,22 +16860,29 @@
"400": {
"description": "projectId is required",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:create or task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -15968,9 +16890,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16037,9 +16959,9 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16047,9 +16969,9 @@
"401": {
"description": "GitLab rejected the token, or the instance is unreachable",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16057,9 +16979,9 @@
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16132,9 +17054,9 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16142,9 +17064,9 @@
"401": {
"description": "GitLab rejected the token",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16152,9 +17074,9 @@
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16194,22 +17116,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16283,22 +17212,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16306,9 +17242,9 @@
"409": {
"description": "That GitLab project is already linked to another Kaneo project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16364,22 +17300,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16389,7 +17332,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/GitlabIntegrationNotFound"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16397,9 +17340,9 @@
"409": {
"description": "Integration changed; refresh before updating settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16437,22 +17380,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16460,9 +17410,9 @@
"404": {
"description": "GitLab integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16510,22 +17460,29 @@
"400": {
"description": "projectId is required",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:create or task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16533,9 +17490,9 @@
"404": {
"description": "Project not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16575,22 +17532,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16698,22 +17662,29 @@
"400": {
"description": "The webhook URL failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16823,22 +17794,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16846,9 +17824,9 @@
"404": {
"description": "Webhook integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16894,22 +17872,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16917,9 +17902,9 @@
"404": {
"description": "Webhook integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -16959,22 +17944,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17057,22 +18049,29 @@
"400": {
"description": "The webhook URL failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17157,22 +18156,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17180,9 +18186,9 @@
"404": {
"description": "Discord integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17228,22 +18234,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17251,9 +18264,9 @@
"404": {
"description": "Discord integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17293,22 +18306,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17391,22 +18411,29 @@
"400": {
"description": "The webhook URL failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17491,22 +18518,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17514,9 +18548,9 @@
"404": {
"description": "Mattermost integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17562,22 +18596,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17585,9 +18626,9 @@
"404": {
"description": "Mattermost integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17627,22 +18668,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17725,22 +18773,29 @@
"400": {
"description": "The webhook URL failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17825,22 +18880,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17848,9 +18910,9 @@
"404": {
"description": "Slack integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17896,22 +18958,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17919,9 +18988,9 @@
"404": {
"description": "Slack integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -17961,22 +19030,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18068,22 +19144,29 @@
"400": {
"description": "The bot token or chat failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18177,22 +19260,29 @@
"400": {
"description": "The resulting config failed validation",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18200,9 +19290,9 @@
"404": {
"description": "Telegram integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18248,22 +19338,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing workspace:manage_settings",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18271,9 +19368,9 @@
"404": {
"description": "Telegram integration not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18316,22 +19413,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the task's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18392,22 +19496,29 @@
"400": {
"description": "Invalid body",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18415,9 +19526,9 @@
"404": {
"description": "Source or target task not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18425,9 +19536,9 @@
"409": {
"description": "This relation already exists",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18465,14 +19576,21 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18480,9 +19598,9 @@
"404": {
"description": "Task relation not found, or its source task is gone",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18546,9 +19664,9 @@
"400": {
"description": "Invalid external link data",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18556,9 +19674,9 @@
"401": {
"description": "Unauthorized",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18566,9 +19684,9 @@
"403": {
"description": "No permission to update the task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18609,22 +19727,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the task's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18672,9 +19797,9 @@
"400": {
"description": "Unknown task or invalid link data",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18682,9 +19807,9 @@
"401": {
"description": "Unauthorized",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18692,9 +19817,9 @@
"403": {
"description": "No permission to update the task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18702,9 +19827,9 @@
"404": {
"description": "Manual resource link not found on this task",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18747,22 +19872,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the project's workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18826,22 +19958,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18881,22 +20020,29 @@
"400": {
"description": "Unknown rule, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
- "401": {
- "description": "Missing or invalid credentials"
- },
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -18927,7 +20073,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -18962,7 +20115,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -19012,22 +20172,29 @@
"400": {
"description": "Workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the workspace or to the project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19035,9 +20202,9 @@
"404": {
"description": "Project not found in this workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19077,22 +20244,29 @@
"400": {
"description": "Workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No access to the workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19136,22 +20310,29 @@
"400": {
"description": "Workspace ID could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing member:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19230,22 +20411,29 @@
"400": {
"description": "Invalid body, the member is an owner, or a project is not in this workspace",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "Missing member:update permission, changing your own access, or granting a project you can't access",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19253,9 +20441,9 @@
"404": {
"description": "Member not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19298,22 +20486,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or missing read permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19356,22 +20551,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or missing read permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19414,22 +20616,29 @@
"400": {
"description": "Unknown task, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or missing task:read permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19472,22 +20681,29 @@
"400": {
"description": "Unknown project, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access or missing read permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19564,22 +20780,29 @@
"400": {
"description": "Invalid body, or unknown project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19652,22 +20875,29 @@
"400": {
"description": "A custom field does not belong to this project",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19723,22 +20953,29 @@
"400": {
"description": "Invalid body, unknown task, or unknown custom field",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing task:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19778,22 +21015,29 @@
"400": {
"description": "Unknown custom field, or its workspace could not be determined",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "No workspace access, or missing project:update permission",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19823,9 +21067,9 @@
"401": {
"description": "Unauthorized",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19833,9 +21077,9 @@
"404": {
"description": "User not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19892,22 +21136,29 @@
"400": {
"description": "Unsupported content type, malformed base64, or too large",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"408": {
"description": "Request body timed out",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19915,9 +21166,9 @@
"413": {
"description": "Request body exceeds the upload limit",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -19943,7 +21194,14 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
}
}
}
@@ -20005,22 +21263,29 @@
"400": {
"description": "Invalid search, page, or limit",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20085,22 +21350,29 @@
"400": {
"description": "Invalid search, page, or limit",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20141,14 +21413,21 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20156,9 +21435,9 @@
"404": {
"description": "Workspace not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20225,22 +21504,29 @@
"400": {
"description": "Unknown role, or the owner role was requested",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20248,9 +21534,9 @@
"404": {
"description": "Workspace or user not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20258,9 +21544,9 @@
"409": {
"description": "The user is already a member",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20302,14 +21588,21 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20317,9 +21610,9 @@
"404": {
"description": "Workspace not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20391,22 +21684,29 @@
"400": {
"description": "Unknown role, or the owner role was requested",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20414,9 +21714,9 @@
"404": {
"description": "Workspace or member not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20424,9 +21724,9 @@
"409": {
"description": "The member is the only owner",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20475,14 +21775,21 @@
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20490,9 +21797,9 @@
"404": {
"description": "Workspace or member not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20500,9 +21807,9 @@
"409": {
"description": "The member is the only owner",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20565,22 +21872,29 @@
"400": {
"description": "The member is already the only owner",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
- "description": "Missing or invalid credentials"
+ "description": "Missing or invalid credentials",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApiError"
+ }
+ }
+ }
},
"403": {
"description": "The caller is not an instance administrator or is authenticated with an API key",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
@@ -20588,9 +21902,9 @@
"404": {
"description": "Workspace or member not found",
"content": {
- "text/plain": {
+ "application/json": {
"schema": {
- "type": "string"
+ "$ref": "#/components/schemas/ApiError"
}
}
}
diff --git a/apps/web/src/fetchers/activity/create-activity.ts b/apps/web/src/fetchers/activity/create-activity.ts
index 50d40feb4..3b41f4f13 100644
--- a/apps/web/src/fetchers/activity/create-activity.ts
+++ b/apps/web/src/fetchers/activity/create-activity.ts
@@ -15,7 +15,7 @@ async function createActivity({ taskId, comment }: CreateActivityRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/activity/get-activites-by-task-id.ts b/apps/web/src/fetchers/activity/get-activites-by-task-id.ts
index 29acd355b..3d7557bd9 100644
--- a/apps/web/src/fetchers/activity/get-activites-by-task-id.ts
+++ b/apps/web/src/fetchers/activity/get-activites-by-task-id.ts
@@ -16,7 +16,7 @@ async function getActivitesByTaskId({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/activity/get-workspace-activities.ts b/apps/web/src/fetchers/activity/get-workspace-activities.ts
index b0239b35c..ec7ee7e2c 100644
--- a/apps/web/src/fetchers/activity/get-workspace-activities.ts
+++ b/apps/web/src/fetchers/activity/get-workspace-activities.ts
@@ -13,7 +13,7 @@ async function getWorkspaceActivities(workspaceId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/add-admin-workspace-member.ts b/apps/web/src/fetchers/admin/add-admin-workspace-member.ts
index 4426d2561..c1b123c7b 100644
--- a/apps/web/src/fetchers/admin/add-admin-workspace-member.ts
+++ b/apps/web/src/fetchers/admin/add-admin-workspace-member.ts
@@ -13,7 +13,7 @@ export async function addAdminWorkspaceMember({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/get-admin-users.test.ts b/apps/web/src/fetchers/admin/get-admin-users.test.ts
index 5b9721b4e..6df35e145 100644
--- a/apps/web/src/fetchers/admin/get-admin-users.test.ts
+++ b/apps/web/src/fetchers/admin/get-admin-users.test.ts
@@ -80,7 +80,8 @@ describe("getAdminUsers", () => {
mocks.get.mockResolvedValue({
ok: false,
status: 403,
- text: async () => "Forbidden",
+ text: async () =>
+ JSON.stringify({ message: "Forbidden", code: "FORBIDDEN" }),
});
const error = await getAdminUsers("", 0).catch((caught) => caught);
@@ -88,5 +89,6 @@ describe("getAdminUsers", () => {
expect(error).toBeInstanceOf(HttpError);
expect(error.status).toBe(403);
expect(error.message).toBe("Forbidden");
+ expect(error.code).toBe("FORBIDDEN");
});
});
diff --git a/apps/web/src/fetchers/admin/get-admin-users.ts b/apps/web/src/fetchers/admin/get-admin-users.ts
index a99b8c1c0..faf5f9331 100644
--- a/apps/web/src/fetchers/admin/get-admin-users.ts
+++ b/apps/web/src/fetchers/admin/get-admin-users.ts
@@ -15,7 +15,7 @@ export async function getAdminUsers(search: string, page: number) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/get-admin-workspace-members.ts b/apps/web/src/fetchers/admin/get-admin-workspace-members.ts
index 8e09b4c94..ef852e382 100644
--- a/apps/web/src/fetchers/admin/get-admin-workspace-members.ts
+++ b/apps/web/src/fetchers/admin/get-admin-workspace-members.ts
@@ -7,7 +7,7 @@ export async function getAdminWorkspaceMembers(workspaceId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/get-admin-workspace-roles.ts b/apps/web/src/fetchers/admin/get-admin-workspace-roles.ts
index aa10a7c76..f82453f12 100644
--- a/apps/web/src/fetchers/admin/get-admin-workspace-roles.ts
+++ b/apps/web/src/fetchers/admin/get-admin-workspace-roles.ts
@@ -7,7 +7,7 @@ export async function getAdminWorkspaceRoles(workspaceId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/get-admin-workspaces.test.ts b/apps/web/src/fetchers/admin/get-admin-workspaces.test.ts
index d8a806ddc..dbbf2a3d5 100644
--- a/apps/web/src/fetchers/admin/get-admin-workspaces.test.ts
+++ b/apps/web/src/fetchers/admin/get-admin-workspaces.test.ts
@@ -76,7 +76,8 @@ describe("getAdminWorkspaces", () => {
mocks.get.mockResolvedValue({
ok: false,
status: 403,
- text: async () => "Forbidden",
+ text: async () =>
+ JSON.stringify({ message: "Forbidden", code: "FORBIDDEN" }),
});
const error = await getAdminWorkspaces("", 0).catch((caught) => caught);
@@ -84,5 +85,6 @@ describe("getAdminWorkspaces", () => {
expect(error).toBeInstanceOf(HttpError);
expect(error.status).toBe(403);
expect(error.message).toBe("Forbidden");
+ expect(error.code).toBe("FORBIDDEN");
});
});
diff --git a/apps/web/src/fetchers/admin/get-admin-workspaces.ts b/apps/web/src/fetchers/admin/get-admin-workspaces.ts
index 3cc191a15..b4d92626e 100644
--- a/apps/web/src/fetchers/admin/get-admin-workspaces.ts
+++ b/apps/web/src/fetchers/admin/get-admin-workspaces.ts
@@ -18,7 +18,7 @@ export async function getAdminWorkspaces(search: string, page: number) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/remove-admin-workspace-member.ts b/apps/web/src/fetchers/admin/remove-admin-workspace-member.ts
index a7f3cc41d..f145629cb 100644
--- a/apps/web/src/fetchers/admin/remove-admin-workspace-member.ts
+++ b/apps/web/src/fetchers/admin/remove-admin-workspace-member.ts
@@ -13,7 +13,7 @@ export async function removeAdminWorkspaceMember({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/transfer-admin-workspace-ownership.ts b/apps/web/src/fetchers/admin/transfer-admin-workspace-ownership.ts
index 7daf3af1f..1b675064a 100644
--- a/apps/web/src/fetchers/admin/transfer-admin-workspace-ownership.ts
+++ b/apps/web/src/fetchers/admin/transfer-admin-workspace-ownership.ts
@@ -12,7 +12,7 @@ export async function transferAdminWorkspaceOwnership({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/admin/update-admin-workspace-member-role.ts b/apps/web/src/fetchers/admin/update-admin-workspace-member-role.ts
index 1ad75e4cd..ea67417cd 100644
--- a/apps/web/src/fetchers/admin/update-admin-workspace-member-role.ts
+++ b/apps/web/src/fetchers/admin/update-admin-workspace-member-role.ts
@@ -15,7 +15,7 @@ export async function updateAdminWorkspaceMemberRole({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/billing/create-checkout.ts b/apps/web/src/fetchers/billing/create-checkout.ts
index a348fdbe0..6e2b2d4da 100644
--- a/apps/web/src/fetchers/billing/create-checkout.ts
+++ b/apps/web/src/fetchers/billing/create-checkout.ts
@@ -15,7 +15,7 @@ export async function createBillingCheckout(input: {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
@@ -27,7 +27,7 @@ export async function createBillingPortal(workspaceId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/billing/get-billing.ts b/apps/web/src/fetchers/billing/get-billing.ts
index 4144b8e2c..56023022b 100644
--- a/apps/web/src/fetchers/billing/get-billing.ts
+++ b/apps/web/src/fetchers/billing/get-billing.ts
@@ -13,7 +13,7 @@ export async function getBilling(workspaceId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/calendar-feed.ts b/apps/web/src/fetchers/calendar-feed.ts
index 40ad7ecf5..b2a538969 100644
--- a/apps/web/src/fetchers/calendar-feed.ts
+++ b/apps/web/src/fetchers/calendar-feed.ts
@@ -6,7 +6,7 @@ const endpoint = client["calendar-feed"].project[":projectId"];
export async function getCalendarFeeds(projectId: string) {
const response = await endpoint.$get({ param: { projectId } });
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
@@ -19,13 +19,13 @@ export async function createCalendarFeed(
param: { projectId },
json: { labelIds, timeZone },
});
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
export async function revokeCalendarFeed(projectId: string, id: string) {
const response = await endpoint[":id"].$delete({ param: { projectId, id } });
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/column/create-column.ts b/apps/web/src/fetchers/column/create-column.ts
index d24c03eba..58413731e 100644
--- a/apps/web/src/fetchers/column/create-column.ts
+++ b/apps/web/src/fetchers/column/create-column.ts
@@ -12,7 +12,7 @@ async function createColumn(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/column/delete-column.ts b/apps/web/src/fetchers/column/delete-column.ts
index fa03be05c..987c58dda 100644
--- a/apps/web/src/fetchers/column/delete-column.ts
+++ b/apps/web/src/fetchers/column/delete-column.ts
@@ -8,7 +8,7 @@ async function deleteColumn(id: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/column/get-columns.ts b/apps/web/src/fetchers/column/get-columns.ts
index fbd7014fb..856994e73 100644
--- a/apps/web/src/fetchers/column/get-columns.ts
+++ b/apps/web/src/fetchers/column/get-columns.ts
@@ -8,7 +8,7 @@ async function getColumns(projectId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/column/reorder-columns.ts b/apps/web/src/fetchers/column/reorder-columns.ts
index c32554f40..7f59a652e 100644
--- a/apps/web/src/fetchers/column/reorder-columns.ts
+++ b/apps/web/src/fetchers/column/reorder-columns.ts
@@ -12,7 +12,7 @@ async function reorderColumns(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/column/update-column.ts b/apps/web/src/fetchers/column/update-column.ts
index cfad8476a..400697b82 100644
--- a/apps/web/src/fetchers/column/update-column.ts
+++ b/apps/web/src/fetchers/column/update-column.ts
@@ -17,7 +17,7 @@ async function updateColumn(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/comment/create-comment.ts b/apps/web/src/fetchers/comment/create-comment.ts
index 97654941a..c96e8794e 100644
--- a/apps/web/src/fetchers/comment/create-comment.ts
+++ b/apps/web/src/fetchers/comment/create-comment.ts
@@ -15,7 +15,7 @@ async function createComment({ taskId, comment }: CreateCommentRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/comment/delete-comment.ts b/apps/web/src/fetchers/comment/delete-comment.ts
index fe1f20383..8a65522c5 100644
--- a/apps/web/src/fetchers/comment/delete-comment.ts
+++ b/apps/web/src/fetchers/comment/delete-comment.ts
@@ -12,7 +12,7 @@ async function deleteComment({ activityId }: DeleteCommentRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/comment/update-comment.ts b/apps/web/src/fetchers/comment/update-comment.ts
index 2e53b23ed..c4bd47400 100644
--- a/apps/web/src/fetchers/comment/update-comment.ts
+++ b/apps/web/src/fetchers/comment/update-comment.ts
@@ -15,7 +15,7 @@ async function updateComment({ activityId, comment }: UpdateCommentRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/config/get-config.ts b/apps/web/src/fetchers/config/get-config.ts
index 858cafc56..052c33464 100644
--- a/apps/web/src/fetchers/config/get-config.ts
+++ b/apps/web/src/fetchers/config/get-config.ts
@@ -11,7 +11,7 @@ export async function getConfig() {
const response = await client.config.$get();
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/custom-field/create-custom-field.ts b/apps/web/src/fetchers/custom-field/create-custom-field.ts
index d926170f0..7aa4bca50 100644
--- a/apps/web/src/fetchers/custom-field/create-custom-field.ts
+++ b/apps/web/src/fetchers/custom-field/create-custom-field.ts
@@ -26,7 +26,7 @@ async function createCustomField({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/custom-field/delete-custom-field.ts b/apps/web/src/fetchers/custom-field/delete-custom-field.ts
index 8358041ef..8521707ee 100644
--- a/apps/web/src/fetchers/custom-field/delete-custom-field.ts
+++ b/apps/web/src/fetchers/custom-field/delete-custom-field.ts
@@ -8,7 +8,7 @@ async function deleteCustomField({ id }: { id: string }) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/custom-field/get-custom-field-filter-values.ts b/apps/web/src/fetchers/custom-field/get-custom-field-filter-values.ts
index 087adb05b..d10be338b 100644
--- a/apps/web/src/fetchers/custom-field/get-custom-field-filter-values.ts
+++ b/apps/web/src/fetchers/custom-field/get-custom-field-filter-values.ts
@@ -14,7 +14,7 @@ async function getCustomFieldFilterValues({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/custom-field/get-custom-field-values-by-project.ts b/apps/web/src/fetchers/custom-field/get-custom-field-values-by-project.ts
index 38241afb4..9b603584c 100644
--- a/apps/web/src/fetchers/custom-field/get-custom-field-values-by-project.ts
+++ b/apps/web/src/fetchers/custom-field/get-custom-field-values-by-project.ts
@@ -14,7 +14,7 @@ async function getCustomFieldValuesByProject({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/custom-field/get-custom-field-values-by-task.ts b/apps/web/src/fetchers/custom-field/get-custom-field-values-by-task.ts
index e3a0949ef..64421fe8e 100644
--- a/apps/web/src/fetchers/custom-field/get-custom-field-values-by-task.ts
+++ b/apps/web/src/fetchers/custom-field/get-custom-field-values-by-task.ts
@@ -8,7 +8,7 @@ async function getCustomFieldValuesByTask({ taskId }: { taskId: string }) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/custom-field/get-custom-fields-by-project.ts b/apps/web/src/fetchers/custom-field/get-custom-fields-by-project.ts
index 86cc19f81..d3517cc98 100644
--- a/apps/web/src/fetchers/custom-field/get-custom-fields-by-project.ts
+++ b/apps/web/src/fetchers/custom-field/get-custom-fields-by-project.ts
@@ -8,7 +8,7 @@ async function getCustomFieldsByProject({ projectId }: { projectId: string }) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/custom-field/reorder-custom-field.ts b/apps/web/src/fetchers/custom-field/reorder-custom-field.ts
index 3fe6f1cde..8d94504a8 100644
--- a/apps/web/src/fetchers/custom-field/reorder-custom-field.ts
+++ b/apps/web/src/fetchers/custom-field/reorder-custom-field.ts
@@ -12,7 +12,7 @@ async function reorderCustomFields(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/custom-field/set-custom-field-value.ts b/apps/web/src/fetchers/custom-field/set-custom-field-value.ts
index a0162d4f6..b9957955e 100644
--- a/apps/web/src/fetchers/custom-field/set-custom-field-value.ts
+++ b/apps/web/src/fetchers/custom-field/set-custom-field-value.ts
@@ -16,7 +16,7 @@ async function setCustomFieldValue({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/discord-integration/create-discord-integration.ts b/apps/web/src/fetchers/discord-integration/create-discord-integration.ts
index 1746976a0..dfed01a57 100644
--- a/apps/web/src/fetchers/discord-integration/create-discord-integration.ts
+++ b/apps/web/src/fetchers/discord-integration/create-discord-integration.ts
@@ -32,7 +32,7 @@ async function createDiscordIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as DiscordIntegration;
diff --git a/apps/web/src/fetchers/discord-integration/delete-discord-integration.ts b/apps/web/src/fetchers/discord-integration/delete-discord-integration.ts
index e124b4826..fbaa5cf15 100644
--- a/apps/web/src/fetchers/discord-integration/delete-discord-integration.ts
+++ b/apps/web/src/fetchers/discord-integration/delete-discord-integration.ts
@@ -15,7 +15,7 @@ async function deleteDiscordIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/discord-integration/get-discord-integration.ts b/apps/web/src/fetchers/discord-integration/get-discord-integration.ts
index 23c3b0c85..936ce7d1c 100644
--- a/apps/web/src/fetchers/discord-integration/get-discord-integration.ts
+++ b/apps/web/src/fetchers/discord-integration/get-discord-integration.ts
@@ -29,7 +29,7 @@ async function getDiscordIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as DiscordIntegration;
diff --git a/apps/web/src/fetchers/discord-integration/update-discord-integration.ts b/apps/web/src/fetchers/discord-integration/update-discord-integration.ts
index 7439301f8..ffb044f0f 100644
--- a/apps/web/src/fetchers/discord-integration/update-discord-integration.ts
+++ b/apps/web/src/fetchers/discord-integration/update-discord-integration.ts
@@ -33,7 +33,7 @@ async function updateDiscordIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as DiscordIntegration;
diff --git a/apps/web/src/fetchers/external-link/create-external-link.ts b/apps/web/src/fetchers/external-link/create-external-link.ts
index 2dbf13496..1eb7d62c8 100644
--- a/apps/web/src/fetchers/external-link/create-external-link.ts
+++ b/apps/web/src/fetchers/external-link/create-external-link.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
export type CreateExternalLinkRequest = {
taskId: string;
@@ -20,8 +21,7 @@ async function createExternalLink({
});
if (!response.ok) {
- const error = await response.text();
- throw new Error(error);
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/external-link/delete-external-link.ts b/apps/web/src/fetchers/external-link/delete-external-link.ts
index 1d1693950..6826edf84 100644
--- a/apps/web/src/fetchers/external-link/delete-external-link.ts
+++ b/apps/web/src/fetchers/external-link/delete-external-link.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
export default async function deleteExternalLink({
taskId,
@@ -10,6 +11,6 @@ export default async function deleteExternalLink({
const response = await client["external-link"].task[":taskId"][":id"].$delete(
{ param: { taskId, id } },
);
- if (!response.ok) throw new Error(await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/external-link/get-external-links.ts b/apps/web/src/fetchers/external-link/get-external-links.ts
index f332311c0..1a05589b7 100644
--- a/apps/web/src/fetchers/external-link/get-external-links.ts
+++ b/apps/web/src/fetchers/external-link/get-external-links.ts
@@ -8,7 +8,7 @@ async function getExternalLinks(taskId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts b/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts
index cfccd173f..39bc0406b 100644
--- a/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts
+++ b/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts
@@ -39,7 +39,7 @@ async function createGenericWebhookIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as GenericWebhookIntegration;
diff --git a/apps/web/src/fetchers/generic-webhook-integration/delete-generic-webhook-integration.ts b/apps/web/src/fetchers/generic-webhook-integration/delete-generic-webhook-integration.ts
index f55290a23..b33a120c5 100644
--- a/apps/web/src/fetchers/generic-webhook-integration/delete-generic-webhook-integration.ts
+++ b/apps/web/src/fetchers/generic-webhook-integration/delete-generic-webhook-integration.ts
@@ -15,7 +15,7 @@ async function deleteGenericWebhookIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts b/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts
index 7f3114e72..73d0da50a 100644
--- a/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts
+++ b/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts
@@ -39,7 +39,7 @@ async function getGenericWebhookIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as GenericWebhookIntegration | null;
diff --git a/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts b/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts
index bafb72238..994467ce4 100644
--- a/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts
+++ b/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts
@@ -40,7 +40,7 @@ async function updateGenericWebhookIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as GenericWebhookIntegration;
diff --git a/apps/web/src/fetchers/gitea-integration/create-gitea-integration.ts b/apps/web/src/fetchers/gitea-integration/create-gitea-integration.ts
index dcb1f1da8..8ab1d63e7 100644
--- a/apps/web/src/fetchers/gitea-integration/create-gitea-integration.ts
+++ b/apps/web/src/fetchers/gitea-integration/create-gitea-integration.ts
@@ -20,18 +20,7 @@ async function createGiteaIntegration(
});
if (!response.ok) {
- const error = await response
- .clone()
- .json()
- .catch(async () => ({
- message: (await response.text()) || "Request failed",
- }));
- throw new HttpError(
- response.status,
- typeof error === "object" && error && "message" in error
- ? String(error.message)
- : "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitea-integration/delete-gitea-integration.ts b/apps/web/src/fetchers/gitea-integration/delete-gitea-integration.ts
index 0074e21fd..b7c8e9548 100644
--- a/apps/web/src/fetchers/gitea-integration/delete-gitea-integration.ts
+++ b/apps/web/src/fetchers/gitea-integration/delete-gitea-integration.ts
@@ -10,7 +10,7 @@ async function deleteGiteaIntegration(projectId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitea-integration/get-gitea-integration.ts b/apps/web/src/fetchers/gitea-integration/get-gitea-integration.ts
index 3c58f8d25..0ca0ffde4 100644
--- a/apps/web/src/fetchers/gitea-integration/get-gitea-integration.ts
+++ b/apps/web/src/fetchers/gitea-integration/get-gitea-integration.ts
@@ -10,7 +10,7 @@ async function getGiteaIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/gitea-integration/import-gitea-issues.ts b/apps/web/src/fetchers/gitea-integration/import-gitea-issues.ts
index 2e127f558..a72dbf323 100644
--- a/apps/web/src/fetchers/gitea-integration/import-gitea-issues.ts
+++ b/apps/web/src/fetchers/gitea-integration/import-gitea-issues.ts
@@ -8,7 +8,7 @@ async function importGiteaIssues(projectId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitea-integration/list-gitea-repositories.ts b/apps/web/src/fetchers/gitea-integration/list-gitea-repositories.ts
index f298b564e..b05d67a06 100644
--- a/apps/web/src/fetchers/gitea-integration/list-gitea-repositories.ts
+++ b/apps/web/src/fetchers/gitea-integration/list-gitea-repositories.ts
@@ -19,10 +19,7 @@ async function listGiteaRepositories(
});
if (!response.ok) {
- throw new HttpError(
- response.status,
- (await response.text()) || "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitea-integration/update-gitea-integration.ts b/apps/web/src/fetchers/gitea-integration/update-gitea-integration.ts
index c8f8c4441..be9994e3b 100644
--- a/apps/web/src/fetchers/gitea-integration/update-gitea-integration.ts
+++ b/apps/web/src/fetchers/gitea-integration/update-gitea-integration.ts
@@ -18,18 +18,7 @@ async function updateGiteaIntegration(
});
if (!response.ok) {
- const error = await response
- .clone()
- .json()
- .catch(async () => ({
- message: (await response.text()) || "Request failed",
- }));
- throw new HttpError(
- response.status,
- typeof error === "object" && error && "message" in error
- ? String(error.message)
- : "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts b/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts
index 5ef551734..27bb3559d 100644
--- a/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts
+++ b/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts
@@ -19,18 +19,7 @@ async function verifyGiteaAccess(
});
if (!response.ok) {
- const error = await response
- .clone()
- .json()
- .catch(async () => ({
- message: (await response.text()) || "Request failed",
- }));
- throw new HttpError(
- response.status,
- typeof error === "object" && error && "message" in error
- ? String((error as { message: string }).message)
- : "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/github-integration/create-github-integration.ts b/apps/web/src/fetchers/github-integration/create-github-integration.ts
index a3e7086de..e65ae9644 100644
--- a/apps/web/src/fetchers/github-integration/create-github-integration.ts
+++ b/apps/web/src/fetchers/github-integration/create-github-integration.ts
@@ -18,7 +18,7 @@ async function createGithubIntegration(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const result = await response.json();
diff --git a/apps/web/src/fetchers/github-integration/delete-github-integration.ts b/apps/web/src/fetchers/github-integration/delete-github-integration.ts
index ab98a13b1..159cd3d6f 100644
--- a/apps/web/src/fetchers/github-integration/delete-github-integration.ts
+++ b/apps/web/src/fetchers/github-integration/delete-github-integration.ts
@@ -10,7 +10,7 @@ async function deleteGithubIntegration(projectId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const result = await response.json();
diff --git a/apps/web/src/fetchers/github-integration/get-app-info.ts b/apps/web/src/fetchers/github-integration/get-app-info.ts
index 655aed28a..6159cef4a 100644
--- a/apps/web/src/fetchers/github-integration/get-app-info.ts
+++ b/apps/web/src/fetchers/github-integration/get-app-info.ts
@@ -11,7 +11,7 @@ export default async function getGitHubAppInfo(): Promise<GitHubAppInfo> {
const response = await client["github-integration"]["app-info"].$get();
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const result = await response.json();
diff --git a/apps/web/src/fetchers/github-integration/get-github-integration.ts b/apps/web/src/fetchers/github-integration/get-github-integration.ts
index 0ed62c648..5b79b3462 100644
--- a/apps/web/src/fetchers/github-integration/get-github-integration.ts
+++ b/apps/web/src/fetchers/github-integration/get-github-integration.ts
@@ -10,7 +10,7 @@ async function getGithubIntegration(projectId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/github-integration/import-github-issues.test.ts b/apps/web/src/fetchers/github-integration/import-github-issues.test.ts
index 4d79ea942..676060051 100644
--- a/apps/web/src/fetchers/github-integration/import-github-issues.test.ts
+++ b/apps/web/src/fetchers/github-integration/import-github-issues.test.ts
@@ -82,25 +82,38 @@ describe("resumable GitHub import client", () => {
});
it("backs off for busy imports and stops after five retries", async () => {
vi.useFakeTimers();
- request.mockImplementation(
- async () => new Response("busy", { status: 429 }),
+ request.mockImplementation(async () =>
+ Response.json(
+ {
+ message: "GitHub import is busy; retry this request",
+ code: "RATE_LIMITED",
+ },
+ { status: 429, headers: { "Retry-After": "1" } },
+ ),
);
const pending = importGithubIssues({ projectId: "project" });
- const rejection = expect(pending).rejects.toMatchObject({ status: 429 });
+ const rejection = expect(pending).rejects.toMatchObject({
+ status: 429,
+ code: "RATE_LIMITED",
+ message: "GitHub import is busy; retry this request",
+ });
await vi.advanceTimersByTimeAsync(999);
expect(request).toHaveBeenCalledTimes(1);
await vi.advanceTimersByTimeAsync(4001);
await rejection;
expect(request).toHaveBeenCalledTimes(6);
});
- it.each([403, 409, 502])(
- "does not automatically restart on HTTP %i",
- async (status) => {
- request.mockResolvedValueOnce(new Response("paused", { status }));
- await expect(
- importGithubIssues({ projectId: "project", runId: "run-1" }),
- ).rejects.toMatchObject({ status });
- expect(request).toHaveBeenCalledTimes(1);
- },
- );
+ it.each([
+ [403, "FORBIDDEN"],
+ [409, "CONFLICT"],
+ [502, "BAD_GATEWAY"],
+ ])("does not automatically restart on HTTP %i", async (status, code) => {
+ request.mockResolvedValueOnce(
+ Response.json({ message: "paused", code }, { status }),
+ );
+ await expect(
+ importGithubIssues({ projectId: "project", runId: "run-1" }),
+ ).rejects.toMatchObject({ status, message: "paused", code });
+ expect(request).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/apps/web/src/fetchers/github-integration/import-github-issues.ts b/apps/web/src/fetchers/github-integration/import-github-issues.ts
index 5e2ff8350..b7fe0954a 100644
--- a/apps/web/src/fetchers/github-integration/import-github-issues.ts
+++ b/apps/web/src/fetchers/github-integration/import-github-issues.ts
@@ -18,8 +18,7 @@ async function importGithubIssues(data: ImportGithubIssuesRequest) {
await new Promise((resolve) => setTimeout(resolve, 1000));
continue;
}
- if (!response.ok)
- throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
const result = await response.json();
if (response.status !== 202) return result;
runId = result.runId;
diff --git a/apps/web/src/fetchers/github-integration/list-repositories.ts b/apps/web/src/fetchers/github-integration/list-repositories.ts
index 79bde3fd0..16eb8cef2 100644
--- a/apps/web/src/fetchers/github-integration/list-repositories.ts
+++ b/apps/web/src/fetchers/github-integration/list-repositories.ts
@@ -27,7 +27,7 @@ async function listRepositories(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const result = await response.json();
diff --git a/apps/web/src/fetchers/github-integration/update-github-integration.ts b/apps/web/src/fetchers/github-integration/update-github-integration.ts
index 85a551758..10a19abca 100644
--- a/apps/web/src/fetchers/github-integration/update-github-integration.ts
+++ b/apps/web/src/fetchers/github-integration/update-github-integration.ts
@@ -18,7 +18,7 @@ async function updateGithubIntegration(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/github-integration/verify-github-installation.ts b/apps/web/src/fetchers/github-integration/verify-github-installation.ts
index 4a53c1e24..442487385 100644
--- a/apps/web/src/fetchers/github-integration/verify-github-installation.ts
+++ b/apps/web/src/fetchers/github-integration/verify-github-installation.ts
@@ -19,10 +19,7 @@ async function verifyGithubInstallation(
});
if (!response.ok) {
- throw new HttpError(
- response.status,
- (await response.text()) || "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
const result = await response.json();
diff --git a/apps/web/src/fetchers/gitlab-integration/create-gitlab-integration.ts b/apps/web/src/fetchers/gitlab-integration/create-gitlab-integration.ts
index 8b9935f1a..daece8d96 100644
--- a/apps/web/src/fetchers/gitlab-integration/create-gitlab-integration.ts
+++ b/apps/web/src/fetchers/gitlab-integration/create-gitlab-integration.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
export type CreateGitlabIntegrationRequest = {
baseUrl: string;
@@ -19,17 +20,7 @@ async function createGitlabIntegration(
});
if (!response.ok) {
- const error = await response
- .clone()
- .json()
- .catch(async () => ({
- message: (await response.text()) || "Request failed",
- }));
- throw new Error(
- typeof error === "object" && error && "message" in error
- ? String(error.message)
- : "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitlab-integration/delete-gitlab-integration.ts b/apps/web/src/fetchers/gitlab-integration/delete-gitlab-integration.ts
index 3c3c3ea5b..ecac8b3e7 100644
--- a/apps/web/src/fetchers/gitlab-integration/delete-gitlab-integration.ts
+++ b/apps/web/src/fetchers/gitlab-integration/delete-gitlab-integration.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
async function deleteGitlabIntegration(projectId: string) {
const response = await client["gitlab-integration"].project[
@@ -8,8 +9,7 @@ async function deleteGitlabIntegration(projectId: string) {
});
if (!response.ok) {
- const error = await response.text();
- throw new Error(error);
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitlab-integration/get-gitlab-integration.ts b/apps/web/src/fetchers/gitlab-integration/get-gitlab-integration.ts
index ac49d316c..06121eeb7 100644
--- a/apps/web/src/fetchers/gitlab-integration/get-gitlab-integration.ts
+++ b/apps/web/src/fetchers/gitlab-integration/get-gitlab-integration.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
async function getGitlabIntegration(projectId: string) {
const response = await client["gitlab-integration"].project[
@@ -8,8 +9,7 @@ async function getGitlabIntegration(projectId: string) {
});
if (!response.ok) {
- const error = await response.text();
- throw new Error(error);
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/gitlab-integration/import-gitlab-issues.ts b/apps/web/src/fetchers/gitlab-integration/import-gitlab-issues.ts
index 27c618852..1d9e76afe 100644
--- a/apps/web/src/fetchers/gitlab-integration/import-gitlab-issues.ts
+++ b/apps/web/src/fetchers/gitlab-integration/import-gitlab-issues.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
async function importGitlabIssues(projectId: string) {
const response = await client["gitlab-integration"]["import-issues"].$post({
@@ -6,8 +7,7 @@ async function importGitlabIssues(projectId: string) {
});
if (!response.ok) {
- const error = await response.text();
- throw new Error(error);
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitlab-integration/list-gitlab-projects.ts b/apps/web/src/fetchers/gitlab-integration/list-gitlab-projects.ts
index b5e50bb49..d5b1a80b5 100644
--- a/apps/web/src/fetchers/gitlab-integration/list-gitlab-projects.ts
+++ b/apps/web/src/fetchers/gitlab-integration/list-gitlab-projects.ts
@@ -1,5 +1,6 @@
import { client } from "@kaneo/libs";
import type { InferRequestType, InferResponseType } from "hono";
+import { HttpError } from "@/lib/http-error";
export type ListGitlabProjectsRequest = InferRequestType<
(typeof client)["gitlab-integration"]["projects"]["$post"]
@@ -18,8 +19,7 @@ async function listGitlabProjects(
});
if (!response.ok) {
- const err = await response.text();
- throw new Error(err || "Request failed");
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitlab-integration/update-gitlab-integration.ts b/apps/web/src/fetchers/gitlab-integration/update-gitlab-integration.ts
index 4a127228e..9a00c83f3 100644
--- a/apps/web/src/fetchers/gitlab-integration/update-gitlab-integration.ts
+++ b/apps/web/src/fetchers/gitlab-integration/update-gitlab-integration.ts
@@ -1,5 +1,6 @@
import { client } from "@kaneo/libs";
import type { InferRequestType } from "hono";
+import { HttpError } from "@/lib/http-error";
export type UpdateGitlabIntegrationRequest = InferRequestType<
(typeof client)["gitlab-integration"]["project"][":projectId"]["$patch"]
@@ -17,17 +18,7 @@ async function updateGitlabIntegration(
});
if (!response.ok) {
- const error = await response
- .clone()
- .json()
- .catch(async () => ({
- message: (await response.text()) || "Request failed",
- }));
- throw new Error(
- typeof error === "object" && error && "message" in error
- ? String(error.message)
- : "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/gitlab-integration/verify-gitlab-access.ts b/apps/web/src/fetchers/gitlab-integration/verify-gitlab-access.ts
index 2f110da7c..610c2fddc 100644
--- a/apps/web/src/fetchers/gitlab-integration/verify-gitlab-access.ts
+++ b/apps/web/src/fetchers/gitlab-integration/verify-gitlab-access.ts
@@ -1,5 +1,6 @@
import { client } from "@kaneo/libs";
import type { InferRequestType, InferResponseType } from "hono";
+import { HttpError } from "@/lib/http-error";
export type VerifyGitlabAccessRequest = InferRequestType<
(typeof client)["gitlab-integration"]["verify"]["$post"]
@@ -18,14 +19,7 @@ async function verifyGitlabAccess(
});
if (!response.ok) {
- const error = await response
- .json()
- .catch(() => ({ message: "Request failed" }));
- throw new Error(
- typeof error === "object" && error && "message" in error
- ? String((error as { message: string }).message)
- : "Request failed",
- );
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/instance/get-instance-status.ts b/apps/web/src/fetchers/instance/get-instance-status.ts
index 4cfd9c9f3..58102964b 100644
--- a/apps/web/src/fetchers/instance/get-instance-status.ts
+++ b/apps/web/src/fetchers/instance/get-instance-status.ts
@@ -14,15 +14,14 @@ export async function getInstanceStatus(): Promise<InstanceStatus> {
if (!response.ok) {
// Surface the server's error body when available so the UI can
// distinguish "instance unreachable" from other failures.
- let detail = "";
- try {
- detail = (await response.text()).trim();
- } catch {}
+ const error = await HttpError.fromResponse(response);
+ const detail = error.message.trim();
throw new HttpError(
response.status,
detail
? `Failed to fetch instance status: ${detail}`
: "Failed to fetch instance status",
+ error,
);
}
return response.json();
diff --git a/apps/web/src/fetchers/integration-sync/get-sync-rules.ts b/apps/web/src/fetchers/integration-sync/get-sync-rules.ts
index 730775f51..1fef98309 100644
--- a/apps/web/src/fetchers/integration-sync/get-sync-rules.ts
+++ b/apps/web/src/fetchers/integration-sync/get-sync-rules.ts
@@ -6,6 +6,6 @@ export default async function getSyncRules(param: SyncParams, after?: string) {
const response = await client["integration-sync"].project[":projectId"][
":provider"
].$get({ param, query: after ? { after } : {} });
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/integration-sync/preview-sync-rules.ts b/apps/web/src/fetchers/integration-sync/preview-sync-rules.ts
index b850b8fd0..9fedda02d 100644
--- a/apps/web/src/fetchers/integration-sync/preview-sync-rules.ts
+++ b/apps/web/src/fetchers/integration-sync/preview-sync-rules.ts
@@ -9,6 +9,6 @@ export default async function previewSyncRules(
const response = await client["integration-sync"].project[":projectId"][
":provider"
].preview.$post({ param, json: { rules } });
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/integration-sync/resume-sync.ts b/apps/web/src/fetchers/integration-sync/resume-sync.ts
index 845790f1d..896b36c24 100644
--- a/apps/web/src/fetchers/integration-sync/resume-sync.ts
+++ b/apps/web/src/fetchers/integration-sync/resume-sync.ts
@@ -14,6 +14,6 @@ export default async function resumeSync(
param: { ...param, linkId },
json: { token, source },
});
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/integration-sync/review-sync-resume.ts b/apps/web/src/fetchers/integration-sync/review-sync-resume.ts
index d70a10e7d..a5cb941f3 100644
--- a/apps/web/src/fetchers/integration-sync/review-sync-resume.ts
+++ b/apps/web/src/fetchers/integration-sync/review-sync-resume.ts
@@ -13,6 +13,6 @@ export default async function reviewSyncResume(
{ param: { ...param, linkId } },
{ init: { signal } },
);
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/integration-sync/save-sync-rules.ts b/apps/web/src/fetchers/integration-sync/save-sync-rules.ts
index 7dbb232b9..0b77d10bf 100644
--- a/apps/web/src/fetchers/integration-sync/save-sync-rules.ts
+++ b/apps/web/src/fetchers/integration-sync/save-sync-rules.ts
@@ -10,6 +10,6 @@ export default async function saveSyncRules(
const response = await client["integration-sync"].project[":projectId"][
":provider"
].$patch({ param, json: { rules, previewToken } });
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/invitation/get-invitation-details.ts b/apps/web/src/fetchers/invitation/get-invitation-details.ts
index 83c6ef7e6..9133da54a 100644
--- a/apps/web/src/fetchers/invitation/get-invitation-details.ts
+++ b/apps/web/src/fetchers/invitation/get-invitation-details.ts
@@ -27,7 +27,7 @@ export async function getInvitationDetails(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const result = await response.json();
diff --git a/apps/web/src/fetchers/label/attach-label-to-task.ts b/apps/web/src/fetchers/label/attach-label-to-task.ts
index e4aaf6283..855a4b4b9 100644
--- a/apps/web/src/fetchers/label/attach-label-to-task.ts
+++ b/apps/web/src/fetchers/label/attach-label-to-task.ts
@@ -16,7 +16,7 @@ async function attachLabelToTask({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/label/create-label.ts b/apps/web/src/fetchers/label/create-label.ts
index 1f5bfefae..5a37b6597 100644
--- a/apps/web/src/fetchers/label/create-label.ts
+++ b/apps/web/src/fetchers/label/create-label.ts
@@ -22,7 +22,7 @@ async function createLabel({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/label/delete-label.test.ts b/apps/web/src/fetchers/label/delete-label.test.ts
index 9305e683b..d37a87d33 100644
--- a/apps/web/src/fetchers/label/delete-label.test.ts
+++ b/apps/web/src/fetchers/label/delete-label.test.ts
@@ -18,6 +18,14 @@ const root = {
workspaceId: "workspace",
taskId: null,
};
+const busy = () =>
+ Response.json(
+ {
+ message: "Label deletion is busy; retry this request",
+ code: "RATE_LIMITED",
+ },
+ { status: 429, headers: { "Retry-After": "1" } },
+ );
beforeEach(() => {
request.mockReset();
});
@@ -70,11 +78,13 @@ describe("resumable label deletion client", () => {
it("backs off when busy and stops after five retries", async () => {
vi.useFakeTimers();
- request.mockImplementation(
- async () => new Response("busy", { status: 429 }),
- );
+ request.mockImplementation(async () => busy());
const operation = deleteLabel({ id: root.id });
- const rejection = expect(operation).rejects.toMatchObject({ status: 429 });
+ const rejection = expect(operation).rejects.toMatchObject({
+ status: 429,
+ code: "RATE_LIMITED",
+ message: "Label deletion is busy; retry this request",
+ });
await vi.advanceTimersByTimeAsync(999);
expect(request).toHaveBeenCalledTimes(1);
await vi.advanceTimersByTimeAsync(4001);
@@ -85,7 +95,7 @@ describe("resumable label deletion client", () => {
it("continues after temporary contention without reporting success early", async () => {
vi.useFakeTimers();
request
- .mockResolvedValueOnce(new Response("busy", { status: 429 }))
+ .mockResolvedValueOnce(busy())
.mockResolvedValueOnce(
Response.json({ ...root, pendingDeletion: true }, { status: 202 }),
)
@@ -97,9 +107,20 @@ describe("resumable label deletion client", () => {
});
it("does not retry authorization failures", async () => {
- request.mockResolvedValueOnce(new Response("forbidden", { status: 403 }));
+ request.mockResolvedValueOnce(
+ Response.json(
+ {
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["label:delete"],
+ },
+ { status: 403 },
+ ),
+ );
await expect(deleteLabel({ id: root.id })).rejects.toMatchObject({
status: 403,
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["label:delete"],
});
expect(request).toHaveBeenCalledTimes(1);
});
diff --git a/apps/web/src/fetchers/label/delete-label.ts b/apps/web/src/fetchers/label/delete-label.ts
index 00a90c253..aaf0cbca7 100644
--- a/apps/web/src/fetchers/label/delete-label.ts
+++ b/apps/web/src/fetchers/label/delete-label.ts
@@ -15,8 +15,7 @@ async function deleteLabel({ id }: DeleteLabelRequest) {
await new Promise((resolve) => setTimeout(resolve, 1000));
continue;
}
- if (!response.ok)
- throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
const data = await response.json();
if (response.status !== 202) return data;
busyRetries = 0;
diff --git a/apps/web/src/fetchers/label/detach-label-from-task.ts b/apps/web/src/fetchers/label/detach-label-from-task.ts
index 7d0e453ab..05ce229ac 100644
--- a/apps/web/src/fetchers/label/detach-label-from-task.ts
+++ b/apps/web/src/fetchers/label/detach-label-from-task.ts
@@ -11,7 +11,7 @@ async function detachLabelFromTask({ labelId }: DetachLabelFromTaskRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/label/get-label-by-workspace.ts b/apps/web/src/fetchers/label/get-label-by-workspace.ts
index 61d57d7b1..6a6b7d8ef 100644
--- a/apps/web/src/fetchers/label/get-label-by-workspace.ts
+++ b/apps/web/src/fetchers/label/get-label-by-workspace.ts
@@ -14,7 +14,7 @@ async function getLabelsByTask({ workspaceId }: GetLabelsByTaskRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/label/get-labels-by-task.ts b/apps/web/src/fetchers/label/get-labels-by-task.ts
index 302f64cf1..e613ce6e2 100644
--- a/apps/web/src/fetchers/label/get-labels-by-task.ts
+++ b/apps/web/src/fetchers/label/get-labels-by-task.ts
@@ -14,7 +14,7 @@ async function getLabelsByTask({ taskId }: GetLabelsByTaskRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/label/update-label.ts b/apps/web/src/fetchers/label/update-label.ts
index 7c8f6120e..c83eb9247 100644
--- a/apps/web/src/fetchers/label/update-label.ts
+++ b/apps/web/src/fetchers/label/update-label.ts
@@ -14,7 +14,7 @@ async function updateLabel({ id, name, color }: UpdateLabelRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/mattermost-integration/create-mattermost-integration.ts b/apps/web/src/fetchers/mattermost-integration/create-mattermost-integration.ts
index 94c6a81db..0fb24663f 100644
--- a/apps/web/src/fetchers/mattermost-integration/create-mattermost-integration.ts
+++ b/apps/web/src/fetchers/mattermost-integration/create-mattermost-integration.ts
@@ -32,7 +32,7 @@ async function createMattermostIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as MattermostIntegration;
diff --git a/apps/web/src/fetchers/mattermost-integration/delete-mattermost-integration.ts b/apps/web/src/fetchers/mattermost-integration/delete-mattermost-integration.ts
index 5cbad6fd0..ca93e3b72 100644
--- a/apps/web/src/fetchers/mattermost-integration/delete-mattermost-integration.ts
+++ b/apps/web/src/fetchers/mattermost-integration/delete-mattermost-integration.ts
@@ -15,7 +15,7 @@ async function deleteMattermostIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/mattermost-integration/get-mattermost-integration.ts b/apps/web/src/fetchers/mattermost-integration/get-mattermost-integration.ts
index e3de1150b..05365ab9f 100644
--- a/apps/web/src/fetchers/mattermost-integration/get-mattermost-integration.ts
+++ b/apps/web/src/fetchers/mattermost-integration/get-mattermost-integration.ts
@@ -29,7 +29,7 @@ async function getMattermostIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as MattermostIntegration;
diff --git a/apps/web/src/fetchers/mattermost-integration/update-mattermost-integration.ts b/apps/web/src/fetchers/mattermost-integration/update-mattermost-integration.ts
index 747177b7b..df629f6ea 100644
--- a/apps/web/src/fetchers/mattermost-integration/update-mattermost-integration.ts
+++ b/apps/web/src/fetchers/mattermost-integration/update-mattermost-integration.ts
@@ -33,7 +33,7 @@ async function updateMattermostIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as MattermostIntegration;
diff --git a/apps/web/src/fetchers/notification-preferences/delete-notification-workspace-rule.ts b/apps/web/src/fetchers/notification-preferences/delete-notification-workspace-rule.ts
index 2e1998612..f70223e34 100644
--- a/apps/web/src/fetchers/notification-preferences/delete-notification-workspace-rule.ts
+++ b/apps/web/src/fetchers/notification-preferences/delete-notification-workspace-rule.ts
@@ -14,7 +14,7 @@ async function deleteNotificationWorkspaceRule(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as NotificationPreferences;
diff --git a/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts b/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
index 00a3ce175..67752b358 100644
--- a/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
+++ b/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
@@ -51,7 +51,7 @@ async function getNotificationPreferences(): Promise<NotificationPreferences> {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as NotificationPreferences;
diff --git a/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts b/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
index a807f67f9..5b19a2296 100644
--- a/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
+++ b/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
@@ -34,7 +34,7 @@ async function updateNotificationPreferences(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as NotificationPreferences;
diff --git a/apps/web/src/fetchers/notification-preferences/upsert-notification-workspace-rule.ts b/apps/web/src/fetchers/notification-preferences/upsert-notification-workspace-rule.ts
index ba9e6d9cc..fcf1cbf6d 100644
--- a/apps/web/src/fetchers/notification-preferences/upsert-notification-workspace-rule.ts
+++ b/apps/web/src/fetchers/notification-preferences/upsert-notification-workspace-rule.ts
@@ -29,7 +29,7 @@ async function upsertNotificationWorkspaceRule(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as NotificationPreferences;
diff --git a/apps/web/src/fetchers/notification/clear-notifications.ts b/apps/web/src/fetchers/notification/clear-notifications.ts
index fcb48e539..e565eba00 100644
--- a/apps/web/src/fetchers/notification/clear-notifications.ts
+++ b/apps/web/src/fetchers/notification/clear-notifications.ts
@@ -8,7 +8,7 @@ async function clearNotifications(workspaceId?: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/notification/get-notifications.ts b/apps/web/src/fetchers/notification/get-notifications.ts
index fbf91c346..ed3d07bde 100644
--- a/apps/web/src/fetchers/notification/get-notifications.ts
+++ b/apps/web/src/fetchers/notification/get-notifications.ts
@@ -6,7 +6,7 @@ async function getNotifications(workspaceId?: string) {
const response = await client.notification.$get({ query: { workspaceId } });
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/notification/mark-all-notifications-as-read.ts b/apps/web/src/fetchers/notification/mark-all-notifications-as-read.ts
index 1ac0e0236..2a6fffc2d 100644
--- a/apps/web/src/fetchers/notification/mark-all-notifications-as-read.ts
+++ b/apps/web/src/fetchers/notification/mark-all-notifications-as-read.ts
@@ -8,7 +8,7 @@ async function markAllNotificationsAsRead(workspaceId?: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/notification/mark-notification-as-read.ts b/apps/web/src/fetchers/notification/mark-notification-as-read.ts
index 4e63d1b97..122db1f01 100644
--- a/apps/web/src/fetchers/notification/mark-notification-as-read.ts
+++ b/apps/web/src/fetchers/notification/mark-notification-as-read.ts
@@ -8,7 +8,7 @@ async function markNotificationAsRead(id: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/oauth/get-id-token.ts b/apps/web/src/fetchers/oauth/get-id-token.ts
index 6a024f012..5218ff2e2 100644
--- a/apps/web/src/fetchers/oauth/get-id-token.ts
+++ b/apps/web/src/fetchers/oauth/get-id-token.ts
@@ -11,7 +11,7 @@ export async function getIdToken() {
const response = await client.oauth["id-token"].$get();
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/project/background.ts b/apps/web/src/fetchers/project/background.ts
index 472e4e180..6c9869418 100644
--- a/apps/web/src/fetchers/project/background.ts
+++ b/apps/web/src/fetchers/project/background.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
export async function uploadProjectBackground(projectId: string, file: File) {
const uploadResponse = await client.project[":id"]["background-upload"].$put({
@@ -6,7 +7,7 @@ export async function uploadProjectBackground(projectId: string, file: File) {
json: { contentType: file.type, size: file.size },
});
- if (!uploadResponse.ok) throw new Error(await uploadResponse.text());
+ if (!uploadResponse.ok) throw await HttpError.fromResponse(uploadResponse);
const upload = await uploadResponse.json();
const storageResponse = await fetch(upload.uploadUrl, {
@@ -27,7 +28,8 @@ export async function uploadProjectBackground(projectId: string, file: File) {
version: upload.version,
},
});
- if (!finalizeResponse.ok) throw new Error(await finalizeResponse.text());
+ if (!finalizeResponse.ok)
+ throw await HttpError.fromResponse(finalizeResponse);
return finalizeResponse.json();
}
@@ -36,5 +38,5 @@ export async function removeProjectBackground(projectId: string) {
const response = await client.project[":id"].background.$delete({
param: { id: projectId },
});
- if (!response.ok) throw new Error(await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
}
diff --git a/apps/web/src/fetchers/project/create-project.ts b/apps/web/src/fetchers/project/create-project.ts
index 1a2c558f2..71e305deb 100644
--- a/apps/web/src/fetchers/project/create-project.ts
+++ b/apps/web/src/fetchers/project/create-project.ts
@@ -17,7 +17,7 @@ async function createProject({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/project/delete-project.ts b/apps/web/src/fetchers/project/delete-project.ts
index a7dd4b1ca..db77c204c 100644
--- a/apps/web/src/fetchers/project/delete-project.ts
+++ b/apps/web/src/fetchers/project/delete-project.ts
@@ -10,7 +10,7 @@ async function deleteProject({ id }: DeleteProjectRequest) {
const response = await client.project[":id"].$delete({ param: { id } });
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/project/get-project.ts b/apps/web/src/fetchers/project/get-project.ts
index db0e14c7d..a30c1263c 100644
--- a/apps/web/src/fetchers/project/get-project.ts
+++ b/apps/web/src/fetchers/project/get-project.ts
@@ -14,7 +14,7 @@ async function getProject({ id }: GetProjectRequest) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/project/get-projects.ts b/apps/web/src/fetchers/project/get-projects.ts
index 3864aca65..3adf435eb 100644
--- a/apps/web/src/fetchers/project/get-projects.ts
+++ b/apps/web/src/fetchers/project/get-projects.ts
@@ -17,7 +17,7 @@ async function getProjects({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/project/get-public-project.ts b/apps/web/src/fetchers/project/get-public-project.ts
index 73b3d2f69..8452133db 100644
--- a/apps/web/src/fetchers/project/get-public-project.ts
+++ b/apps/web/src/fetchers/project/get-public-project.ts
@@ -33,8 +33,7 @@ async function getPublicProject(
},
{ init: { signal } },
);
- if (!response.ok)
- throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
const { pagination, ...data } = await response.json();
if (page === 1 && !relatedPage) revision = pagination.revision;
else if (revision !== undefined && pagination.revision !== revision)
diff --git a/apps/web/src/fetchers/project/move-project.ts b/apps/web/src/fetchers/project/move-project.ts
index 57bd8a66b..5b51c050c 100644
--- a/apps/web/src/fetchers/project/move-project.ts
+++ b/apps/web/src/fetchers/project/move-project.ts
@@ -1,5 +1,6 @@
import { client } from "@kaneo/libs";
import type { InferRequestType } from "hono/client";
+import { HttpError } from "@/lib/http-error";
export type MoveProjectRequest = InferRequestType<
(typeof client)["project"][":id"]["move"]["$put"]
@@ -13,8 +14,7 @@ async function moveProject({ id, workspaceId }: MoveProjectRequest) {
});
if (!response.ok) {
- const error = await response.text();
- throw new Error(error);
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/project/reorder-projects.ts b/apps/web/src/fetchers/project/reorder-projects.ts
index d3cc2111e..04be9323f 100644
--- a/apps/web/src/fetchers/project/reorder-projects.ts
+++ b/apps/web/src/fetchers/project/reorder-projects.ts
@@ -12,7 +12,7 @@ async function reorderProjects(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/project/update-project.ts b/apps/web/src/fetchers/project/update-project.ts
index d92dabe55..11ebac75b 100644
--- a/apps/web/src/fetchers/project/update-project.ts
+++ b/apps/web/src/fetchers/project/update-project.ts
@@ -21,7 +21,7 @@ async function updateProject({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/search/global-search.ts b/apps/web/src/fetchers/search/global-search.ts
index 9bbb5c4c3..45c9ff6a7 100644
--- a/apps/web/src/fetchers/search/global-search.ts
+++ b/apps/web/src/fetchers/search/global-search.ts
@@ -27,7 +27,7 @@ async function globalSearch(params: SearchParams) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/slack-integration/create-slack-integration.ts b/apps/web/src/fetchers/slack-integration/create-slack-integration.ts
index f174d157a..b674df1fb 100644
--- a/apps/web/src/fetchers/slack-integration/create-slack-integration.ts
+++ b/apps/web/src/fetchers/slack-integration/create-slack-integration.ts
@@ -32,7 +32,7 @@ async function createSlackIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as SlackIntegration;
diff --git a/apps/web/src/fetchers/slack-integration/delete-slack-integration.ts b/apps/web/src/fetchers/slack-integration/delete-slack-integration.ts
index 04dbcf9a1..86e08662a 100644
--- a/apps/web/src/fetchers/slack-integration/delete-slack-integration.ts
+++ b/apps/web/src/fetchers/slack-integration/delete-slack-integration.ts
@@ -15,7 +15,7 @@ async function deleteSlackIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/slack-integration/get-slack-integration.ts b/apps/web/src/fetchers/slack-integration/get-slack-integration.ts
index bdd819f21..c4f22b36b 100644
--- a/apps/web/src/fetchers/slack-integration/get-slack-integration.ts
+++ b/apps/web/src/fetchers/slack-integration/get-slack-integration.ts
@@ -29,7 +29,7 @@ async function getSlackIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as SlackIntegration;
diff --git a/apps/web/src/fetchers/slack-integration/update-slack-integration.ts b/apps/web/src/fetchers/slack-integration/update-slack-integration.ts
index 3cbc65f58..f5f9c40b3 100644
--- a/apps/web/src/fetchers/slack-integration/update-slack-integration.ts
+++ b/apps/web/src/fetchers/slack-integration/update-slack-integration.ts
@@ -33,7 +33,7 @@ async function updateSlackIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as SlackIntegration;
diff --git a/apps/web/src/fetchers/task-relation/create-task-relation.ts b/apps/web/src/fetchers/task-relation/create-task-relation.ts
index 0b5d6ba90..e66bab98c 100644
--- a/apps/web/src/fetchers/task-relation/create-task-relation.ts
+++ b/apps/web/src/fetchers/task-relation/create-task-relation.ts
@@ -20,7 +20,7 @@ async function createTaskRelation({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task-relation/delete-task-relation.ts b/apps/web/src/fetchers/task-relation/delete-task-relation.ts
index b510ba702..65f6a668e 100644
--- a/apps/web/src/fetchers/task-relation/delete-task-relation.ts
+++ b/apps/web/src/fetchers/task-relation/delete-task-relation.ts
@@ -8,7 +8,7 @@ async function deleteTaskRelation(id: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task-relation/get-task-relations.ts b/apps/web/src/fetchers/task-relation/get-task-relations.ts
index 2dfbfb728..0977ae723 100644
--- a/apps/web/src/fetchers/task-relation/get-task-relations.ts
+++ b/apps/web/src/fetchers/task-relation/get-task-relations.ts
@@ -8,7 +8,7 @@ async function getTaskRelations(taskId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/board-fetchers.test.ts b/apps/web/src/fetchers/task/board-fetchers.test.ts
index 8bda6d2fb..c16b188d5 100644
--- a/apps/web/src/fetchers/task/board-fetchers.test.ts
+++ b/apps/web/src/fetchers/task/board-fetchers.test.ts
@@ -133,10 +133,15 @@ describe("authenticated and public board fetchers", () => {
}),
)
.mockResolvedValueOnce(
- new Response("Project is not public", { status: 403 }),
+ Response.json(
+ { message: "Project is not public", code: "FORBIDDEN" },
+ { status: 403 },
+ ),
);
await expect(getPublicProject({ id: "project" })).rejects.toMatchObject({
status: 403,
+ message: "Project is not public",
+ code: "FORBIDDEN",
});
expect(publicRequest).toHaveBeenCalledTimes(2);
});
diff --git a/apps/web/src/fetchers/task/bulk-operation.ts b/apps/web/src/fetchers/task/bulk-operation.ts
index 261c5ae08..3e99cf9b5 100644
--- a/apps/web/src/fetchers/task/bulk-operation.ts
+++ b/apps/web/src/fetchers/task/bulk-operation.ts
@@ -25,7 +25,7 @@ async function bulkOperation({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/task/create-image-upload.ts b/apps/web/src/fetchers/task/create-image-upload.ts
index babd643ca..88ff2a1f7 100644
--- a/apps/web/src/fetchers/task/create-image-upload.ts
+++ b/apps/web/src/fetchers/task/create-image-upload.ts
@@ -26,7 +26,7 @@ async function createImageUpload({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
@@ -59,7 +59,7 @@ export async function finalizeImageUpload({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/task/create-task.ts b/apps/web/src/fetchers/task/create-task.ts
index 252de24fa..454804e2e 100644
--- a/apps/web/src/fetchers/task/create-task.ts
+++ b/apps/web/src/fetchers/task/create-task.ts
@@ -39,7 +39,7 @@ async function createTask(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/delete-task.ts b/apps/web/src/fetchers/task/delete-task.ts
index 90f048c90..959c58081 100644
--- a/apps/web/src/fetchers/task/delete-task.ts
+++ b/apps/web/src/fetchers/task/delete-task.ts
@@ -10,7 +10,7 @@ async function deleteTask(taskId: string) {
const response = await client.task[":id"].$delete({ param: { id: taskId } });
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/description-pages.test.ts b/apps/web/src/fetchers/task/description-pages.test.ts
index 2bc6ba616..1e839b4da 100644
--- a/apps/web/src/fetchers/task/description-pages.test.ts
+++ b/apps/web/src/fetchers/task/description-pages.test.ts
@@ -62,7 +62,15 @@ describe("deferred descriptions", () => {
.mockResolvedValueOnce(
Response.json({ content: "partial", version: "1", nextOffset: 7 }),
)
- .mockResolvedValueOnce(new Response("unavailable", { status: 409 }));
+ .mockResolvedValueOnce(
+ Response.json(
+ {
+ message: "Description changed or no longer public",
+ code: "CONFLICT",
+ },
+ { status: 409 },
+ ),
+ );
await expect(
getPublicTaskDescription("project", "task"),
).rejects.toMatchObject({
@@ -108,7 +116,15 @@ describe("deferred descriptions", () => {
]);
matchRequest
.mockResolvedValueOnce(Response.json({ ids: ["a"], nextCursor: "a" }))
- .mockResolvedValueOnce(new Response("busy", { status: 503 }));
+ .mockResolvedValueOnce(
+ Response.json(
+ {
+ message: "Description request timed out",
+ code: "SERVICE_UNAVAILABLE",
+ },
+ { status: 503 },
+ ),
+ );
await expect(
getDescriptionMatches("project", "text"),
).rejects.toMatchObject({ status: 503 });
diff --git a/apps/web/src/fetchers/task/duplicate-task.ts b/apps/web/src/fetchers/task/duplicate-task.ts
index 20067035d..ac4e7076b 100644
--- a/apps/web/src/fetchers/task/duplicate-task.ts
+++ b/apps/web/src/fetchers/task/duplicate-task.ts
@@ -1,4 +1,5 @@
import { client } from "@kaneo/libs";
+import { HttpError } from "@/lib/http-error";
async function duplicateTask({
taskId,
@@ -13,8 +14,7 @@ async function duplicateTask({
});
if (!response.ok) {
- const error = await response.text();
- throw new Error(error);
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/export-tasks.ts b/apps/web/src/fetchers/task/export-tasks.ts
index 0e0632897..148b2c902 100644
--- a/apps/web/src/fetchers/task/export-tasks.ts
+++ b/apps/web/src/fetchers/task/export-tasks.ts
@@ -8,7 +8,7 @@ async function exportTasks(projectId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/get-assigned-tasks.ts b/apps/web/src/fetchers/task/get-assigned-tasks.ts
index 5d15481c5..92298b5b5 100644
--- a/apps/web/src/fetchers/task/get-assigned-tasks.ts
+++ b/apps/web/src/fetchers/task/get-assigned-tasks.ts
@@ -15,7 +15,7 @@ async function getAssignedTasks(workspaceId: string, countOnly = false) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/task/get-task-by-ticket-id.ts b/apps/web/src/fetchers/task/get-task-by-ticket-id.ts
index c6c109c50..e6c8329d3 100644
--- a/apps/web/src/fetchers/task/get-task-by-ticket-id.ts
+++ b/apps/web/src/fetchers/task/get-task-by-ticket-id.ts
@@ -8,7 +8,7 @@ async function getTaskByTicketId(ticketId: string, workspaceSlug: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/task/get-task.ts b/apps/web/src/fetchers/task/get-task.ts
index 949256acd..ef1fc511f 100644
--- a/apps/web/src/fetchers/task/get-task.ts
+++ b/apps/web/src/fetchers/task/get-task.ts
@@ -13,7 +13,7 @@ async function getTask(taskId: string, view: "detail" | "board" = "detail") {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/import-tasks.ts b/apps/web/src/fetchers/task/import-tasks.ts
index 519836648..7a0db1922 100644
--- a/apps/web/src/fetchers/task/import-tasks.ts
+++ b/apps/web/src/fetchers/task/import-tasks.ts
@@ -18,7 +18,7 @@ async function importTasks(projectId: string, tasks: TaskToImport[]) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/move-task.ts b/apps/web/src/fetchers/task/move-task.ts
index 6aa846fee..c1eb587ff 100644
--- a/apps/web/src/fetchers/task/move-task.ts
+++ b/apps/web/src/fetchers/task/move-task.ts
@@ -20,19 +20,7 @@ async function moveTask({
});
if (!response.ok) {
- let message: string;
- try {
- const json = await response.json();
- message =
- (json as { message?: string; error?: string }).message ||
- (json as { error?: string }).error ||
- JSON.stringify(json);
- } catch {
- message =
- (await response.text().catch(() => "")) ||
- `API error ${response.status}`;
- }
- throw new HttpError(response.status, message);
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/task/reorder-tasks.ts b/apps/web/src/fetchers/task/reorder-tasks.ts
index 54ece9845..f82d5a392 100644
--- a/apps/web/src/fetchers/task/reorder-tasks.ts
+++ b/apps/web/src/fetchers/task/reorder-tasks.ts
@@ -8,6 +8,6 @@ export type TaskReorder = {
};
export default async function reorderTasks(json: TaskReorder) {
const response = await client.task.reorder.$post({ json });
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
return response.json();
}
diff --git a/apps/web/src/fetchers/task/update-task-assignee.ts b/apps/web/src/fetchers/task/update-task-assignee.ts
index 874296067..0cb18565a 100644
--- a/apps/web/src/fetchers/task/update-task-assignee.ts
+++ b/apps/web/src/fetchers/task/update-task-assignee.ts
@@ -16,7 +16,7 @@ async function updateTaskAssignee(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/update-task-description.ts b/apps/web/src/fetchers/task/update-task-description.ts
index 9dd0f5d32..8fa7d2e09 100644
--- a/apps/web/src/fetchers/task/update-task-description.ts
+++ b/apps/web/src/fetchers/task/update-task-description.ts
@@ -11,7 +11,7 @@ async function updateTaskDescription(taskId: string, task: Task) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/update-task-due-date.ts b/apps/web/src/fetchers/task/update-task-due-date.ts
index 4d2b35cc0..d562411d5 100644
--- a/apps/web/src/fetchers/task/update-task-due-date.ts
+++ b/apps/web/src/fetchers/task/update-task-due-date.ts
@@ -11,7 +11,7 @@ async function updateTaskDueDate(taskId: string, task: Task) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/update-task-priority.ts b/apps/web/src/fetchers/task/update-task-priority.ts
index 13197126b..5e4413c60 100644
--- a/apps/web/src/fetchers/task/update-task-priority.ts
+++ b/apps/web/src/fetchers/task/update-task-priority.ts
@@ -16,7 +16,7 @@ async function updateTaskPriority(taskId: string, task: Task) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/update-task-status.ts b/apps/web/src/fetchers/task/update-task-status.ts
index 00fbbf634..7ba1b2371 100644
--- a/apps/web/src/fetchers/task/update-task-status.ts
+++ b/apps/web/src/fetchers/task/update-task-status.ts
@@ -13,7 +13,7 @@ async function updateTaskStatus(taskId: string, task: UpdateTaskStatusPayload) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/update-task-title.ts b/apps/web/src/fetchers/task/update-task-title.ts
index 8bd5d3712..e0d248341 100644
--- a/apps/web/src/fetchers/task/update-task-title.ts
+++ b/apps/web/src/fetchers/task/update-task-title.ts
@@ -11,7 +11,7 @@ async function updateTaskTitle(taskId: string, task: Task) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/task/update-task.ts b/apps/web/src/fetchers/task/update-task.ts
index f3ab12b02..f5b7d0edc 100644
--- a/apps/web/src/fetchers/task/update-task.ts
+++ b/apps/web/src/fetchers/task/update-task.ts
@@ -30,7 +30,7 @@ async function updateTask(taskId: string, task: Task) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/telegram-integration/create-telegram-integration.ts b/apps/web/src/fetchers/telegram-integration/create-telegram-integration.ts
index 5361e20c5..87c975ac2 100644
--- a/apps/web/src/fetchers/telegram-integration/create-telegram-integration.ts
+++ b/apps/web/src/fetchers/telegram-integration/create-telegram-integration.ts
@@ -34,7 +34,7 @@ async function createTelegramIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as TelegramIntegration;
diff --git a/apps/web/src/fetchers/telegram-integration/delete-telegram-integration.ts b/apps/web/src/fetchers/telegram-integration/delete-telegram-integration.ts
index db787cf31..93b1c346f 100644
--- a/apps/web/src/fetchers/telegram-integration/delete-telegram-integration.ts
+++ b/apps/web/src/fetchers/telegram-integration/delete-telegram-integration.ts
@@ -12,7 +12,7 @@ async function deleteTelegramIntegration(projectId: string) {
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as { success: boolean };
diff --git a/apps/web/src/fetchers/telegram-integration/get-telegram-integration.ts b/apps/web/src/fetchers/telegram-integration/get-telegram-integration.ts
index cdc361376..b6701b809 100644
--- a/apps/web/src/fetchers/telegram-integration/get-telegram-integration.ts
+++ b/apps/web/src/fetchers/telegram-integration/get-telegram-integration.ts
@@ -35,7 +35,7 @@ async function getTelegramIntegration(projectId: string) {
}
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as TelegramIntegration;
diff --git a/apps/web/src/fetchers/telegram-integration/update-telegram-integration.ts b/apps/web/src/fetchers/telegram-integration/update-telegram-integration.ts
index d8b0f5119..8958b166a 100644
--- a/apps/web/src/fetchers/telegram-integration/update-telegram-integration.ts
+++ b/apps/web/src/fetchers/telegram-integration/update-telegram-integration.ts
@@ -35,7 +35,7 @@ async function updateTelegramIntegration(
);
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return (await response.json()) as TelegramIntegration;
diff --git a/apps/web/src/fetchers/time-entry/create-time-entry.ts b/apps/web/src/fetchers/time-entry/create-time-entry.ts
index 91e198aa9..68bdefb28 100644
--- a/apps/web/src/fetchers/time-entry/create-time-entry.ts
+++ b/apps/web/src/fetchers/time-entry/create-time-entry.ts
@@ -20,7 +20,7 @@ async function createTimeEntry({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/time-entry/get-time-entries.ts b/apps/web/src/fetchers/time-entry/get-time-entries.ts
index 22bff9901..857ce7189 100644
--- a/apps/web/src/fetchers/time-entry/get-time-entries.ts
+++ b/apps/web/src/fetchers/time-entry/get-time-entries.ts
@@ -8,7 +8,7 @@ async function getTimeEntriesByTaskId(taskId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/time-entry/update-time-entry.ts b/apps/web/src/fetchers/time-entry/update-time-entry.ts
index f1b784778..ce0d806b2 100644
--- a/apps/web/src/fetchers/time-entry/update-time-entry.ts
+++ b/apps/web/src/fetchers/time-entry/update-time-entry.ts
@@ -24,7 +24,7 @@ async function updateTimeEntry({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
const data = await response.json();
diff --git a/apps/web/src/fetchers/user/delete-avatar.ts b/apps/web/src/fetchers/user/delete-avatar.ts
index b55099751..44e4ef9a5 100644
--- a/apps/web/src/fetchers/user/delete-avatar.ts
+++ b/apps/web/src/fetchers/user/delete-avatar.ts
@@ -6,7 +6,7 @@ async function deleteAvatar() {
const response = await client.user.avatar.$delete();
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/user/upload-avatar.ts b/apps/web/src/fetchers/user/upload-avatar.ts
index 25e5152b3..48d3f276e 100644
--- a/apps/web/src/fetchers/user/upload-avatar.ts
+++ b/apps/web/src/fetchers/user/upload-avatar.ts
@@ -14,7 +14,7 @@ async function uploadAvatar({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/workflow-rule/delete-workflow-rule.ts b/apps/web/src/fetchers/workflow-rule/delete-workflow-rule.ts
index a67267ab1..24b62618a 100644
--- a/apps/web/src/fetchers/workflow-rule/delete-workflow-rule.ts
+++ b/apps/web/src/fetchers/workflow-rule/delete-workflow-rule.ts
@@ -8,7 +8,7 @@ async function deleteWorkflowRule(id: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/workflow-rule/get-workflow-rules.ts b/apps/web/src/fetchers/workflow-rule/get-workflow-rules.ts
index fcbb1d582..165a67e36 100644
--- a/apps/web/src/fetchers/workflow-rule/get-workflow-rules.ts
+++ b/apps/web/src/fetchers/workflow-rule/get-workflow-rules.ts
@@ -8,7 +8,7 @@ async function getWorkflowRules(projectId: string) {
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/workflow-rule/upsert-workflow-rule.ts b/apps/web/src/fetchers/workflow-rule/upsert-workflow-rule.ts
index d83d21578..d6d1142f2 100644
--- a/apps/web/src/fetchers/workflow-rule/upsert-workflow-rule.ts
+++ b/apps/web/src/fetchers/workflow-rule/upsert-workflow-rule.ts
@@ -12,7 +12,7 @@ async function upsertWorkflowRule(
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/workspace-user/get-my-project-access.ts b/apps/web/src/fetchers/workspace-user/get-my-project-access.ts
index 19cb90996..fe3ea62c6 100644
--- a/apps/web/src/fetchers/workspace-user/get-my-project-access.ts
+++ b/apps/web/src/fetchers/workspace-user/get-my-project-access.ts
@@ -7,7 +7,7 @@ async function getMyProjectAccess(workspaceId: string) {
].$get({ param: { workspaceId } });
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/workspace-user/get-project-members.ts b/apps/web/src/fetchers/workspace-user/get-project-members.ts
index 8db7d8172..54807c19a 100644
--- a/apps/web/src/fetchers/workspace-user/get-project-members.ts
+++ b/apps/web/src/fetchers/workspace-user/get-project-members.ts
@@ -16,7 +16,7 @@ async function getProjectMembers({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/workspace-user/get-workspace-project-access.ts b/apps/web/src/fetchers/workspace-user/get-workspace-project-access.ts
index 98ed1942f..e2b8fdc7d 100644
--- a/apps/web/src/fetchers/workspace-user/get-workspace-project-access.ts
+++ b/apps/web/src/fetchers/workspace-user/get-workspace-project-access.ts
@@ -7,7 +7,7 @@ async function getWorkspaceProjectAccess(workspaceId: string) {
].$get({ param: { workspaceId } });
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/fetchers/workspace-user/update-member-project-access.ts b/apps/web/src/fetchers/workspace-user/update-member-project-access.ts
index af839a0ad..3f4be5dc7 100644
--- a/apps/web/src/fetchers/workspace-user/update-member-project-access.ts
+++ b/apps/web/src/fetchers/workspace-user/update-member-project-access.ts
@@ -23,7 +23,7 @@ async function updateMemberProjectAccess({
});
if (!response.ok) {
- throw new HttpError(response.status, await response.text());
+ throw await HttpError.fromResponse(response);
}
return response.json();
diff --git a/apps/web/src/lib/http-error.test.ts b/apps/web/src/lib/http-error.test.ts
index 3e7cded50..ae4d7adaa 100644
--- a/apps/web/src/lib/http-error.test.ts
+++ b/apps/web/src/lib/http-error.test.ts
@@ -28,3 +28,74 @@ describe("isUnauthorizedError", () => {
expect(isUnauthorizedError(error)).toBe(false);
});
});
+
+describe("HttpError.fromResponse", () => {
+ it("parses the JSON error shape", async () => {
+ const error = await HttpError.fromResponse(
+ new Response(
+ JSON.stringify({
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["task:update"],
+ }),
+ { status: 403, headers: { "content-type": "application/json" } },
+ ),
+ );
+
+ expect(error).toBeInstanceOf(HttpError);
+ expect(error.status).toBe(403);
+ expect(error.message).toBe("Insufficient permissions");
+ expect(error.code).toBe("MISSING_PERMISSION");
+ expect(error.missingPermissions).toEqual(["task:update"]);
+ expect(error.issues).toBeUndefined();
+ });
+
+ it("keeps validation issues", async () => {
+ const error = await HttpError.fromResponse(
+ new Response(
+ JSON.stringify({
+ message: "title: Required",
+ code: "VALIDATION_ERROR",
+ issues: [
+ { path: "body.title", message: "Required" },
+ { path: "body.priority", message: "Invalid option" },
+ ],
+ }),
+ { status: 400 },
+ ),
+ );
+
+ expect(error.message).toBe("title: Required");
+ expect(error.issues).toHaveLength(2);
+ });
+
+ it("falls back to a text body from an older API", async () => {
+ const error = await HttpError.fromResponse(
+ new Response("Task not found", { status: 404 }),
+ );
+
+ expect(error.status).toBe(404);
+ expect(error.message).toBe("Task not found");
+ expect(error.code).toBeUndefined();
+ });
+
+ it("keeps an empty message for an empty body", async () => {
+ const error = await HttpError.fromResponse(
+ new Response(null, { status: 502 }),
+ );
+
+ expect(error.status).toBe(502);
+ expect(error.message).toBe("");
+ expect(error.code).toBeUndefined();
+ });
+
+ it("treats an unreadable body as empty", async () => {
+ const error = await HttpError.fromResponse({
+ status: 500,
+ text: () => Promise.reject(new Error("aborted")),
+ });
+
+ expect(error.status).toBe(500);
+ expect(error.message).toBe("");
+ });
+});
diff --git a/apps/web/src/lib/http-error.ts b/apps/web/src/lib/http-error.ts
index 2f09fe596..7064c698b 100644
--- a/apps/web/src/lib/http-error.ts
+++ b/apps/web/src/lib/http-error.ts
@@ -1,10 +1,32 @@
+import {
+ type ApiErrorDetails,
+ type ApiErrorIssue,
+ parseApiErrorBody,
+} from "./parse-api-error-body";
+
export class HttpError extends Error {
status: number;
+ code?: string;
+ issues?: ApiErrorIssue[];
+ missingPermissions?: string[];
- constructor(status: number, message: string) {
+ constructor(status: number, message: string, details: ApiErrorDetails = {}) {
super(message);
this.name = "HttpError";
this.status = status;
+ this.code = details.code;
+ this.issues = details.issues;
+ this.missingPermissions = details.missingPermissions;
+ }
+
+ static async fromResponse(
+ response: Pick<Response, "status" | "text">,
+ ): Promise<HttpError> {
+ const text = await response.text().catch(() => "");
+ const body = parseApiErrorBody(text);
+ return body
+ ? new HttpError(response.status, body.message, body)
+ : new HttpError(response.status, text);
}
}
diff --git a/apps/web/src/lib/parse-api-error-body.test.ts b/apps/web/src/lib/parse-api-error-body.test.ts
new file mode 100644
index 000000000..c795942e2
--- /dev/null
+++ b/apps/web/src/lib/parse-api-error-body.test.ts
@@ -0,0 +1,48 @@
+import { describe, expect, it } from "vite-plus/test";
+import { parseApiErrorBody } from "./parse-api-error-body";
+
+describe("parseApiErrorBody", () => {
+ it("reads the standard error shape", () => {
+ expect(
+ parseApiErrorBody(
+ JSON.stringify({
+ message: "title: Required",
+ code: "VALIDATION_ERROR",
+ issues: [{ path: "body.title", message: "Required" }],
+ missingPermissions: ["task:update"],
+ }),
+ ),
+ ).toEqual({
+ message: "title: Required",
+ code: "VALIDATION_ERROR",
+ issues: [{ path: "body.title", message: "Required" }],
+ missingPermissions: ["task:update"],
+ });
+ });
+
+ it("drops malformed optional fields", () => {
+ expect(
+ parseApiErrorBody(
+ JSON.stringify({
+ message: "Nope",
+ code: 3,
+ issues: [{ path: 1 }],
+ missingPermissions: [true],
+ }),
+ ),
+ ).toEqual({ message: "Nope" });
+ });
+
+ it("accepts an older error-only body", () => {
+ expect(
+ parseApiErrorBody(JSON.stringify({ error: "Integration not found" })),
+ ).toEqual({ message: "Integration not found" });
+ });
+
+ it.each(["", "Task not found", "[]", "null", '{"ok":true}'])(
+ "returns null for %j",
+ (text) => {
+ expect(parseApiErrorBody(text)).toBeNull();
+ },
+ );
+});
diff --git a/apps/web/src/lib/parse-api-error-body.ts b/apps/web/src/lib/parse-api-error-body.ts
new file mode 100644
index 000000000..553e8803b
--- /dev/null
+++ b/apps/web/src/lib/parse-api-error-body.ts
@@ -0,0 +1,58 @@
+export type ApiErrorIssue = { path: string; message: string };
+
+export type ApiErrorDetails = {
+ code?: string;
+ issues?: ApiErrorIssue[];
+ missingPermissions?: string[];
+};
+
+function isIssueList(value: unknown): value is ApiErrorIssue[] {
+ return (
+ Array.isArray(value) &&
+ value.every(
+ (issue) =>
+ typeof issue === "object" &&
+ issue !== null &&
+ typeof issue.path === "string" &&
+ typeof issue.message === "string",
+ )
+ );
+}
+
+function isStringList(value: unknown): value is string[] {
+ return (
+ Array.isArray(value) && value.every((item) => typeof item === "string")
+ );
+}
+
+export function parseApiErrorBody(
+ text: string,
+): ({ message: string } & ApiErrorDetails) | null {
+ if (!text) return null;
+
+ let value: unknown;
+ try {
+ value = JSON.parse(text);
+ } catch {
+ return null;
+ }
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
+
+ const body = value as Record<string, unknown>;
+ const message =
+ typeof body.message === "string"
+ ? body.message
+ : typeof body.error === "string"
+ ? body.error
+ : null;
+ if (message === null) return null;
+
+ return {
+ message,
+ ...(typeof body.code === "string" ? { code: body.code } : {}),
+ ...(isIssueList(body.issues) ? { issues: body.issues } : {}),
+ ...(isStringList(body.missingPermissions)
+ ? { missingPermissions: body.missingPermissions }
+ : {}),
+ };
+}
diff --git a/apps/web/src/lib/upload-draft-asset.ts b/apps/web/src/lib/upload-draft-asset.ts
index e3d2aae96..fc6ca1ef3 100644
--- a/apps/web/src/lib/upload-draft-asset.ts
+++ b/apps/web/src/lib/upload-draft-asset.ts
@@ -14,7 +14,7 @@ export async function uploadDraftAsset(projectId: string, file: File) {
param: { projectId },
json,
});
- if (!response.ok) throw new HttpError(response.status, await response.text());
+ if (!response.ok) throw await HttpError.fromResponse(response);
const upload = await response.json();
const stored = await fetch(upload.uploadUrl, {
method: "PUT",
@@ -29,8 +29,7 @@ export async function uploadDraftAsset(projectId: string, file: File) {
param: { projectId },
json: { ...json, key: upload.key },
});
- if (!finalized.ok)
- throw new HttpError(finalized.status, await finalized.text());
+ if (!finalized.ok) throw await HttpError.fromResponse(finalized);
const asset = await finalized.json();
return {
id: asset.id,
diff --git a/packages/mcp/src/kaneo/client.test.ts b/packages/mcp/src/kaneo/client.test.ts
index 67fde9f30..8dd35d26d 100644
--- a/packages/mcp/src/kaneo/client.test.ts
+++ b/packages/mcp/src/kaneo/client.test.ts
@@ -50,7 +50,12 @@ describe("KaneoClient", () => {
};
const fetchMock = vi
.fn()
- .mockResolvedValueOnce(new Response("unauthorized", { status: 401 }))
+ .mockResolvedValueOnce(
+ new Response(
+ JSON.stringify({ message: "Unauthorized", code: "UNAUTHORIZED" }),
+ { status: 401, headers: { "content-type": "application/json" } },
+ ),
+ )
.mockResolvedValueOnce(
new Response(JSON.stringify({ id: "task-1" }), { status: 200 }),
);
@@ -74,9 +79,13 @@ describe("KaneoClient", () => {
clearToken: vi.fn().mockResolvedValue(undefined),
};
globalThis.fetch = vi.fn().mockResolvedValue(
- new Response(JSON.stringify({ message: "Task not found" }), {
- status: 404,
- }),
+ new Response(
+ JSON.stringify({ message: "Task not found", code: "NOT_FOUND" }),
+ {
+ status: 404,
+ headers: { "content-type": "application/json" },
+ },
+ ),
) as typeof fetch;
const client = new KaneoClient({
@@ -85,7 +94,54 @@ describe("KaneoClient", () => {
});
await expect(client.json("/api/task/missing")).rejects.toThrow(
- "/api/task/missing: Task not found",
+ "/api/task/missing: Task not found (NOT_FOUND)",
+ );
+ });
+
+ it("names missing permissions through the error code", async () => {
+ const auth = {
+ getAccessToken: vi.fn().mockResolvedValue("token-123"),
+ clearToken: vi.fn().mockResolvedValue(undefined),
+ };
+ globalThis.fetch = vi.fn().mockResolvedValue(
+ new Response(
+ JSON.stringify({
+ message: "Insufficient API key scope",
+ code: "API_KEY_SCOPE",
+ missingPermissions: ["task:update"],
+ }),
+ { status: 403, headers: { "content-type": "application/json" } },
+ ),
+ ) as typeof fetch;
+
+ const client = new KaneoClient({
+ baseUrl: "https://api.example.com",
+ auth: auth as never,
+ });
+
+ await expect(client.json("/api/task/task-1")).rejects.toThrow(
+ "/api/task/task-1: Insufficient API key scope (API_KEY_SCOPE)",
+ );
+ });
+
+ it("falls back to a text body from an older API", async () => {
+ const auth = {
+ getAccessToken: vi.fn().mockResolvedValue("token-123"),
+ clearToken: vi.fn().mockResolvedValue(undefined),
+ };
+ globalThis.fetch = vi
+ .fn()
+ .mockResolvedValue(
+ new Response("Task not found", { status: 404 }),
+ ) as typeof fetch;
+
+ const client = new KaneoClient({
+ baseUrl: "https://api.example.com",
+ auth: auth as never,
+ });
+
+ await expect(client.json("/api/task/missing")).rejects.toThrow(
+ /^\/api\/task\/missing: Task not found$/,
);
});
});
diff --git a/packages/mcp/src/kaneo/client.ts b/packages/mcp/src/kaneo/client.ts
index 1b107ea5d..e5852f820 100644
--- a/packages/mcp/src/kaneo/client.ts
+++ b/packages/mcp/src/kaneo/client.ts
@@ -75,7 +75,14 @@ export class KaneoClient {
} else {
detail = `HTTP ${res.status}`;
}
- throw new Error(`${path}: ${detail}`);
+ const code =
+ typeof body === "object" &&
+ body !== null &&
+ "code" in body &&
+ typeof (body as { code: unknown }).code === "string"
+ ? ` (${(body as { code: string }).code})`
+ : "";
+ throw new Error(`${path}: ${detail}${code}`);
}
return body as T;
}
diff --git a/tests/api-integration/asset-finalization.test.ts b/tests/api-integration/asset-finalization.test.ts
index 66cc4a31b..c3477d332 100644
--- a/tests/api-integration/asset-finalization.test.ts
+++ b/tests/api-integration/asset-finalization.test.ts
@@ -19,6 +19,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
async function fixture() {
const member = await createWorkspaceMember();
@@ -83,7 +84,10 @@ describe("asset finalization proof", () => {
const { finalize } = await fixture();
const response = await finalize();
expect(response.status).toBe(400);
- expect(await response.text()).toBe("Uploaded object was not found.");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Uploaded object was not found.",
+ code: "BAD_REQUEST",
+ });
expect(await db.select().from(schema.assetTable)).toHaveLength(0);
expect(send).toHaveBeenCalledOnce();
expect(send.mock.calls[0][0]).toBeInstanceOf(HeadObjectCommand);
@@ -140,7 +144,10 @@ describe("asset finalization proof", () => {
const { finalize } = await fixture();
const response = await finalize();
expect(response.status).toBe(503);
- expect(await response.text()).toBe("Unable to verify uploaded object.");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unable to verify uploaded object.",
+ code: "SERVICE_UNAVAILABLE",
+ });
expect(await db.select().from(schema.assetTable)).toHaveLength(0);
},
);
diff --git a/tests/api-integration/comment.test.ts b/tests/api-integration/comment.test.ts
index ef4083d5f..8a5d6a308 100644
--- a/tests/api-integration/comment.test.ts
+++ b/tests/api-integration/comment.test.ts
@@ -215,6 +215,7 @@ describe("API integration: task comments", () => {
expect(response.headers.get("content-type")).toContain("application/json");
expect(await response.json()).toEqual({
message: "Use the comment endpoint to create comments",
+ code: "BAD_REQUEST",
});
});
diff --git a/tests/api-integration/current-user.test.ts b/tests/api-integration/current-user.test.ts
index 3f4adc721..5c510cb44 100644
--- a/tests/api-integration/current-user.test.ts
+++ b/tests/api-integration/current-user.test.ts
@@ -6,6 +6,7 @@ import { createApp } from "../../apps/api/src/index";
import { mockAuthenticatedSession } from "./helpers/auth";
import { resetTestDatabase } from "./helpers/database";
import { createWorkspaceMember } from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
describe("GET /api/user/me", () => {
beforeEach(async () => {
@@ -44,7 +45,10 @@ describe("GET /api/user/me", () => {
const response = await app.request("/api/user/me");
expect(response.status).toBe(401);
- expect(await response.text()).toBe("Unauthorized");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
});
it.each(["Authorization", "x-api-key"])(
@@ -59,7 +63,10 @@ describe("GET /api/user/me", () => {
});
expect(response.status).toBe(401);
- expect(await response.text()).toBe("Unauthorized");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
},
);
@@ -81,7 +88,10 @@ describe("GET /api/user/me", () => {
});
expect(response.status).toBe(401);
- expect(await response.text()).toBe("Unauthorized");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
});
it("returns 404 when the authenticated user no longer exists", async () => {
@@ -94,6 +104,9 @@ describe("GET /api/user/me", () => {
const response = await app.request("/api/user/me");
expect(response.status).toBe(404);
- expect(await response.text()).toBe("User not found");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "User not found",
+ code: "NOT_FOUND",
+ });
});
});
diff --git a/tests/api-integration/error-shape.test.ts b/tests/api-integration/error-shape.test.ts
new file mode 100644
index 000000000..c063410b6
--- /dev/null
+++ b/tests/api-integration/error-shape.test.ts
@@ -0,0 +1,333 @@
+import { createHash } from "node:crypto";
+import { beforeEach, describe, expect, it } from "vite-plus/test";
+import db, { getDatabasePool, schema } from "../../apps/api/src/database";
+import { createApp } from "../../apps/api/src/index";
+import { MAX_LABEL_DELETIONS_IN_FLIGHT } from "../../apps/api/src/label/deletion-lock";
+import { mockAuthenticatedSession } from "./helpers/auth";
+import { resetTestDatabase } from "./helpers/database";
+import { readErrorBody } from "./helpers/error-body";
+import {
+ createProjectFixture,
+ createWorkspaceMember,
+} from "./helpers/fixtures";
+
+async function seedApiKey(
+ userId: string,
+ permissions: Record<string, string[]> | null,
+) {
+ const key = `error-shape-${userId}`.padEnd(64, "x");
+ await db.insert(schema.apikeyTable).values({
+ referenceId: userId,
+ userId,
+ key: createHash("sha256").update(key).digest("base64url"),
+ permissions: permissions ? JSON.stringify(permissions) : null,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ });
+ return key;
+}
+
+function createTask(
+ app: ReturnType<typeof createApp>["app"],
+ projectId: string,
+ body: unknown,
+ headers: Record<string, string> = {},
+) {
+ return app.request(`/api/task/${projectId}`, {
+ method: "POST",
+ headers: { "content-type": "application/json", ...headers },
+ body: JSON.stringify(body),
+ });
+}
+
+const validTask = {
+ title: "Error shape probe",
+ description: "",
+ priority: "low",
+ status: "to-do",
+};
+
+describe("API integration: error shape", () => {
+ beforeEach(async () => {
+ await resetTestDatabase();
+ });
+
+ it("serializes an HTTPException as JSON with a derived code", async () => {
+ const { app } = createApp();
+
+ const response = await app.request("/api/user/me");
+
+ expect(response.status).toBe(401);
+ expect(await readErrorBody(response)).toEqual({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
+ });
+
+ it("reports every validation issue under VALIDATION_ERROR", async () => {
+ const member = await createWorkspaceMember({ role: "member" });
+ const { project } = await createProjectFixture({
+ workspaceId: member.workspace.id,
+ });
+ mockAuthenticatedSession(member.user);
+ const { app } = createApp();
+
+ const response = await createTask(app, project.id, {
+ priority: "urgent-ish",
+ status: 5,
+ });
+
+ expect(response.status).toBe(400);
+ const body = await readErrorBody(response);
+ expect(body.code).toBe("VALIDATION_ERROR");
+ const paths = body.issues?.map((issue) => issue.path) ?? [];
+ expect(paths).toEqual(
+ expect.arrayContaining([
+ "body.title",
+ "body.description",
+ "body.priority",
+ "body.status",
+ ]),
+ );
+ const [first] = body.issues ?? [];
+ expect(body.message).toBe(
+ `${first?.path.replace(/^body\./, "")}: ${first?.message}`,
+ );
+ });
+
+ it("validates top-level routes with the same hook", async () => {
+ const { app } = createApp();
+
+ const response = await app.request("/api/auth/device?ui=2");
+
+ expect(response.status).toBe(400);
+ const body = await readErrorBody(response);
+ expect(body).toMatchObject({ code: "VALIDATION_ERROR" });
+ expect(body.message).toMatch(/^ui: /);
+ expect(body.issues).toEqual([
+ { path: "query.ui", message: expect.any(String) },
+ ]);
+ });
+
+ it("keeps fixed public-project messages in the standard shape", async () => {
+ const { app } = createApp();
+
+ const response = await app.request(
+ "/api/public-project/missing?page=0&limit=1",
+ );
+
+ expect(response.status).toBe(400);
+ const body = await readErrorBody(response);
+ expect(body).toMatchObject({
+ message: "Invalid task pagination or filters",
+ code: "VALIDATION_ERROR",
+ });
+ expect(body.issues?.[0]?.path).toMatch(/^query\./);
+ });
+
+ it("names the permissions a member lacks", async () => {
+ const viewer = await createWorkspaceMember({ role: "viewer" });
+ const { project } = await createProjectFixture({
+ workspaceId: viewer.workspace.id,
+ });
+ mockAuthenticatedSession(viewer.user);
+ const { app } = createApp();
+
+ const response = await createTask(app, project.id, validTask);
+
+ expect(response.status).toBe(403);
+ expect(await readErrorBody(response)).toEqual({
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["task:create"],
+ });
+ });
+
+ it("names the permissions an API key's scope lacks", async () => {
+ const member = await createWorkspaceMember({ role: "member" });
+ const { project } = await createProjectFixture({
+ workspaceId: member.workspace.id,
+ });
+ const key = await seedApiKey(member.user.id, { task: ["read"] });
+ const { app } = createApp();
+
+ const response = await createTask(app, project.id, validTask, {
+ "x-api-key": key,
+ });
+
+ expect(response.status).toBe(403);
+ expect(await readErrorBody(response)).toEqual({
+ message: "Insufficient API key scope",
+ code: "API_KEY_SCOPE",
+ missingPermissions: ["task:create"],
+ });
+ });
+
+ it("rejects API keys on session-only routes with SESSION_REQUIRED", async () => {
+ const member = await createWorkspaceMember();
+ const key = await seedApiKey(member.user.id, null);
+ const { app } = createApp();
+
+ const response = await app.request("/api/oauth/id-token", {
+ headers: { Authorization: `Bearer ${key}` },
+ });
+
+ expect(response.status).toBe(403);
+ expect(await readErrorBody(response)).toEqual({
+ message: "A user session is required",
+ code: "SESSION_REQUIRED",
+ });
+ });
+
+ it("answers unknown API routes with a JSON 404 and leaves other paths alone", async () => {
+ const member = await createWorkspaceMember();
+ mockAuthenticatedSession(member.user);
+ const { app } = createApp();
+
+ const unknownApi = await app.request("/api/does-not-exist");
+ expect(unknownApi.status).toBe(404);
+ expect(await readErrorBody(unknownApi)).toEqual({
+ message: "Not found",
+ code: "NOT_FOUND",
+ });
+
+ const unknownAuth = await app.request("/api/auth/does-not-exist");
+ expect(unknownAuth.status).toBe(404);
+ expect(await readErrorBody(unknownAuth)).toEqual({
+ message: "Not found",
+ code: "NOT_FOUND",
+ });
+
+ const unknownPage = await app.request("/does-not-exist");
+ expect(unknownPage.status).toBe(404);
+ expect(unknownPage.headers.get("content-type")).not.toContain(
+ "application/json",
+ );
+ });
+
+ it("hides unhandled failures behind a JSON 500", async () => {
+ const member = await createWorkspaceMember();
+ mockAuthenticatedSession(member.user);
+ const { app } = createApp();
+ app.get("/api/error-shape-failure", () => {
+ throw new Error("private failure detail");
+ });
+
+ const response = await app.request("/api/error-shape-failure");
+
+ expect(response.status).toBe(500);
+ expect(await readErrorBody(response)).toEqual({
+ message: "Internal Server Error",
+ code: "INTERNAL_SERVER_ERROR",
+ });
+ });
+
+ it("keeps Retry-After on a busy lock while converting its body", async () => {
+ const member = await createWorkspaceMember({ role: "admin" });
+ const [label] = await db
+ .insert(schema.labelTable)
+ .values({ workspaceId: member.workspace.id, name: "bug", color: "red" })
+ .returning();
+ mockAuthenticatedSession(member.user);
+ const { app } = createApp();
+ const other = await getDatabasePool().connect();
+ try {
+ for (let slot = 0; slot < MAX_LABEL_DELETIONS_IN_FLIGHT; slot++)
+ await other.query("SELECT pg_advisory_lock(773622, $1::int)", [slot]);
+
+ const response = await app.request(`/api/label/${label.id}`, {
+ method: "DELETE",
+ });
+
+ expect(response.status).toBe(429);
+ expect(response.headers.get("Retry-After")).toBe("1");
+ expect(await readErrorBody(response)).toEqual({
+ message: "Label deletion is busy; retry this request",
+ code: "RATE_LIMITED",
+ });
+ } finally {
+ await other.query("SELECT pg_advisory_unlock_all()");
+ other.release();
+ }
+ });
+
+ it("keeps the OAuth error shape on MCP OAuth endpoints", async () => {
+ const { app } = createApp();
+
+ const response = await app.request("/api/mcp/register", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({
+ redirect_uris: ["https://client.example/callback"],
+ grant_types: ["refresh_token"],
+ }),
+ });
+
+ expect(response.status).toBe(400);
+ const body = (await response.json()) as Record<string, unknown>;
+ expect(body).toMatchObject({ error: "invalid_client_metadata" });
+ expect(body).not.toHaveProperty("code");
+ expect(body).not.toHaveProperty("message");
+ });
+
+ it("answers a rejected API key on auth routes with JSON", async () => {
+ const { app } = createApp();
+
+ const response = await app.request("/api/auth/get-session", {
+ headers: { "x-api-key": "not-a-real-key" },
+ });
+
+ expect(response.status).toBe(401);
+ expect(await readErrorBody(response)).toEqual({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
+ });
+
+ it("returns Better Auth errors with a message and code", async () => {
+ const { app } = createApp();
+
+ const response = await app.request("/api/auth/sign-in/email", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({
+ email: "[email protected]",
+ password: "definitely wrong password",
+ }),
+ });
+
+ expect(response.status).toBe(401);
+ const body = await readErrorBody(response);
+ expect(body.message).toEqual(expect.any(String));
+ expect(body.code).toBe("INVALID_EMAIL_OR_PASSWORD");
+ });
+
+ it("keeps RFC 8628 errors while polling for a device token", async () => {
+ const { app } = createApp();
+ const origin = "http://localhost:5173";
+
+ const codeResponse = await app.request("/api/auth/device/code", {
+ method: "POST",
+ headers: { "content-type": "application/json", Origin: origin },
+ body: JSON.stringify({ client_id: "kaneo-cli" }),
+ });
+ const { device_code } = (await codeResponse.json()) as {
+ device_code: string;
+ };
+
+ const response = await app.request("/api/auth/device/token", {
+ method: "POST",
+ headers: { "content-type": "application/json", Origin: origin },
+ body: JSON.stringify({
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
+ device_code,
+ client_id: "kaneo-cli",
+ }),
+ });
+
+ expect(response.status).toBe(400);
+ expect(await response.json()).toMatchObject({
+ error: "authorization_pending",
+ });
+ });
+});
diff --git a/tests/api-integration/helpers/error-body.ts b/tests/api-integration/helpers/error-body.ts
new file mode 100644
index 000000000..8ecb5612c
--- /dev/null
+++ b/tests/api-integration/helpers/error-body.ts
@@ -0,0 +1,13 @@
+import { expect } from "vite-plus/test";
+
+export type ApiErrorBody = {
+ message: string;
+ code: string;
+ issues?: Array<{ path: string; message: string }>;
+ missingPermissions?: string[];
+};
+
+export async function readErrorBody(response: Response) {
+ expect(response.headers.get("content-type")).toContain("application/json");
+ return (await response.json()) as ApiErrorBody;
+}
diff --git a/tests/api-integration/integration-sync-rules.test.ts b/tests/api-integration/integration-sync-rules.test.ts
index 6818d8662..9b734fb9b 100644
--- a/tests/api-integration/integration-sync-rules.test.ts
+++ b/tests/api-integration/integration-sync-rules.test.ts
@@ -35,6 +35,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
const provider = vi.hoisted(() => ({ read: vi.fn(), write: vi.fn() }));
vi.mock("../../apps/api/src/plugins/sync/provider-issue", () => ({
@@ -714,9 +715,10 @@ describe("reviewed sync resume", () => {
token: "a".repeat(64),
});
expect(response.status).toBe(409);
- expect(await response.text()).toBe(
- "Synchronization is busy; retry shortly",
- );
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Synchronization is busy; retry shortly",
+ code: "CONFLICT",
+ });
expect(provider.read).not.toHaveBeenCalled();
expect(provider.write).not.toHaveBeenCalled();
expect((await db.query.jobLeaseTable.findFirst())?.owner).toBe(
diff --git a/tests/api-integration/label.test.ts b/tests/api-integration/label.test.ts
index 186d5a6a0..1508035cb 100644
--- a/tests/api-integration/label.test.ts
+++ b/tests/api-integration/label.test.ts
@@ -8,6 +8,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
describe("API integration: labels", () => {
beforeEach(async () => {
@@ -31,7 +32,10 @@ describe("API integration: labels", () => {
});
expect(response.status).toBe(401);
- await expect(response.text()).resolves.toBe("Unauthorized");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
});
it("creates a label in a workspace for a member", async () => {
@@ -103,9 +107,10 @@ describe("API integration: labels", () => {
});
expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "You don't have access to this workspace",
+ code: "FORBIDDEN",
+ });
const persisted = await db.query.labelTable.findFirst({
where: eq(schema.labelTable.name, "Blocked"),
diff --git a/tests/api-integration/openapi.test.ts b/tests/api-integration/openapi.test.ts
index c6d608691..f06d00df0 100644
--- a/tests/api-integration/openapi.test.ts
+++ b/tests/api-integration/openapi.test.ts
@@ -113,6 +113,32 @@ describe("Kaneo API OpenAPI spec", () => {
);
});
+ it("documents Kaneo errors as ApiError JSON", () => {
+ expect(spec.components.schemas.ApiError).toMatchObject({
+ type: "object",
+ required: ["message", "code"],
+ });
+ const plainText: string[] = [];
+ for (const [method, path, operation] of operations(spec)) {
+ if (path.startsWith("/mcp/")) continue;
+ for (const [status, response] of Object.entries(operation.responses)) {
+ if (!/^[45]/.test(status)) continue;
+ const content = (response as { content?: Record<string, unknown> })
+ .content;
+ if (!content?.["application/json"])
+ plainText.push(`${method.toUpperCase()} ${path} ${status}`);
+ }
+ }
+ expect(plainText).toEqual([]);
+ expect(spec.paths["/task/{id}"]?.get?.responses["401"]).toMatchObject({
+ content: {
+ "application/json": {
+ schema: { $ref: "#/components/schemas/ApiError" },
+ },
+ },
+ });
+ });
+
it("documents a 401 on every operation that requires auth", () => {
const missing: string[] = [];
for (const [method, path, operation] of operations(spec)) {
diff --git a/tests/api-integration/project.test.ts b/tests/api-integration/project.test.ts
index e392c4e80..838c99f14 100644
--- a/tests/api-integration/project.test.ts
+++ b/tests/api-integration/project.test.ts
@@ -8,6 +8,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
describe("API integration: project creation", () => {
beforeEach(async () => {
@@ -32,7 +33,10 @@ describe("API integration: project creation", () => {
});
expect(response.status).toBe(401);
- await expect(response.text()).resolves.toBe("Unauthorized");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
});
it("creates a project for a workspace member and seeds default columns", async () => {
@@ -126,9 +130,10 @@ describe("API integration: project creation", () => {
});
expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "You don't have access to this workspace",
+ code: "FORBIDDEN",
+ });
});
it("rejects a project key already used in the workspace", async () => {
@@ -155,7 +160,9 @@ describe("API integration: project creation", () => {
const duplicate = await create(member.workspace.id, "kan");
expect(duplicate.status).toBe(409);
- await expect(duplicate.text()).resolves.toContain('"kan" (Kanban)');
+ const duplicateError = await readErrorBody(duplicate);
+ expect(duplicateError.code).toBe("CONFLICT");
+ expect(duplicateError.message).toContain('"kan" (Kanban)');
expect((await create(member.workspace.id, "KAN")).status).toBe(409);
mockAuthenticatedSession(other.user);
diff --git a/tests/api-integration/task-duplicate.test.ts b/tests/api-integration/task-duplicate.test.ts
index f4699218e..481955f96 100644
--- a/tests/api-integration/task-duplicate.test.ts
+++ b/tests/api-integration/task-duplicate.test.ts
@@ -1,6 +1,7 @@
import { createHash, randomUUID } from "node:crypto";
import { and, eq } from "drizzle-orm";
import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
+import { readErrorBody } from "./helpers/error-body";
const { copyTaskAssetObject, deleteS3Object, publishEvent } = vi.hoisted(
() => ({
@@ -112,7 +113,10 @@ describe("API integration: task duplication", () => {
const response = await requestDuplicate(app, task.id);
expect(response.status).toBe(401);
- await expect(response.text()).resolves.toBe("Unauthorized");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
});
it("blocks a viewer from duplicating a task (viewer role lacks task:create)", async () => {
@@ -131,7 +135,11 @@ describe("API integration: task duplication", () => {
const response = await requestDuplicate(app, task.id);
expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe("Insufficient permissions");
+ expect(await readErrorBody(response)).toEqual({
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["task:create"],
+ });
const tasks = await db.query.taskTable.findMany({
where: eq(schema.taskTable.projectId, project.id),
@@ -167,9 +175,10 @@ describe("API integration: task duplication", () => {
const response = await requestDuplicate(app, task.id);
expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "You don't have access to this workspace",
+ code: "FORBIDDEN",
+ });
const tasks = await db.query.taskTable.findMany({
where: eq(schema.taskTable.projectId, project.id),
@@ -765,7 +774,10 @@ describe("API integration: task duplication", () => {
.mockRejectedValueOnce(new Error("private bucket details"));
const response = await requestDuplicate(own.app, own.task.id);
expect(response.status).toBe(503);
- expect(await response.text()).toBe("Failed to copy the task attachments");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Failed to copy the task attachments",
+ code: "SERVICE_UNAVAILABLE",
+ });
expect(deleteS3Object).toHaveBeenCalledWith("copied-first");
expect(await db.query.taskTable.findMany()).toHaveLength(1);
expect(publishEvent).not.toHaveBeenCalled();
diff --git a/tests/api-integration/task-image-upload.test.ts b/tests/api-integration/task-image-upload.test.ts
index d35707e80..91d5d5f4e 100644
--- a/tests/api-integration/task-image-upload.test.ts
+++ b/tests/api-integration/task-image-upload.test.ts
@@ -16,6 +16,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
describe("API integration: task image upload finalize", () => {
beforeEach(async () => {
@@ -360,8 +361,10 @@ describe("API integration: task image upload finalize", () => {
);
expect(response.status).toBe(400);
- const text = await response.text();
- expect(text).toBe("Image upload key does not match the task context.");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Image upload key does not match the task context.",
+ code: "BAD_REQUEST",
+ });
});
it("rejects unauthenticated requests", async () => {
@@ -460,8 +463,9 @@ describe("API integration: task image upload finalize", () => {
);
expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "You don't have access to this workspace",
+ code: "FORBIDDEN",
+ });
});
});
diff --git a/tests/api-integration/task-pagination.test.ts b/tests/api-integration/task-pagination.test.ts
index d6f85a7b0..c9c328798 100644
--- a/tests/api-integration/task-pagination.test.ts
+++ b/tests/api-integration/task-pagination.test.ts
@@ -9,6 +9,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
beforeEach(resetTestDatabase);
async function fixture(count = 237, publicProject = false) {
@@ -180,7 +181,11 @@ describe("bounded task pages", () => {
`/api/public-project/${project.id}?limit=101`,
);
expect(response.status).toBe(400);
- expect(response.headers.get("Content-Type")).toContain("text/plain");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Invalid task pagination or filters",
+ code: "VALIDATION_ERROR",
+ issues: [{ path: "query.limit", message: expect.any(String) }],
+ });
});
it("returns empty pages and an empty project without inventing tasks", async () => {
const { project, app } = await fixture(0);
diff --git a/tests/api-integration/task-relation-boundaries.test.ts b/tests/api-integration/task-relation-boundaries.test.ts
index 1192d8d8f..da5b486e1 100644
--- a/tests/api-integration/task-relation-boundaries.test.ts
+++ b/tests/api-integration/task-relation-boundaries.test.ts
@@ -8,6 +8,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
const m = vi.hoisted(() => ({ publish: vi.fn(async () => undefined) }));
vi.mock("../../apps/api/src/events", async (original) => ({
@@ -60,7 +61,10 @@ describe("task relation tenant boundaries", () => {
relationType: "blocks",
});
expect(response.status).toBe(404);
- expect(await response.text()).toBe("Target task not found");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Target task not found",
+ code: "NOT_FOUND",
+ });
}
expect(await db.query.taskRelationTable.findMany()).toHaveLength(0);
expect(m.publish).not.toHaveBeenCalled();
@@ -91,7 +95,10 @@ describe("task relation tenant boundaries", () => {
mockAuthenticatedSession(own.user);
const response = await request(`/${relation.id}`, "DELETE");
expect(response.status).toBe(404);
- expect(await response.text()).toBe("Task relation not found");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Task relation not found",
+ code: "NOT_FOUND",
+ });
expect(
await db.query.taskRelationTable.findFirst({
where: eq(schema.taskRelationTable.id, relation.id),
diff --git a/tests/api-integration/task.test.ts b/tests/api-integration/task.test.ts
index 03e374562..034ab0c85 100644
--- a/tests/api-integration/task.test.ts
+++ b/tests/api-integration/task.test.ts
@@ -9,6 +9,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
describe("API integration: task creation", () => {
beforeEach(async () => {
@@ -38,7 +39,10 @@ describe("API integration: task creation", () => {
});
expect(response.status).toBe(401);
- await expect(response.text()).resolves.toBe("Unauthorized");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Unauthorized",
+ code: "UNAUTHORIZED",
+ });
});
it("creates a task with the matching column, assignee, and next number", async () => {
@@ -159,9 +163,10 @@ describe("API integration: task creation", () => {
});
expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe(
- "You don't have access to this workspace",
- );
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "You don't have access to this workspace",
+ code: "FORBIDDEN",
+ });
const persistedTask = await db.query.taskTable.findFirst({
where: and(
diff --git a/tests/api-integration/tenant-resource-boundaries.test.ts b/tests/api-integration/tenant-resource-boundaries.test.ts
index 38649f712..0dd1312fd 100644
--- a/tests/api-integration/tenant-resource-boundaries.test.ts
+++ b/tests/api-integration/tenant-resource-boundaries.test.ts
@@ -9,6 +9,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
const { syncGithub, syncGitea, removeGithub, removeGitea, publish } =
vi.hoisted(() => ({
@@ -88,7 +89,10 @@ describe("tenant resource boundaries", () => {
taskId,
});
expect(response.status).toBe(404);
- expect(await response.text()).toBe("Task not found");
+ expect(await readErrorBody(response)).toMatchObject({
+ message: "Task not found",
+ code: "NOT_FOUND",
+ });
}
expect(await db.select().from(schema.labelTable)).toHaveLength(0);
expect(syncGithub).not.toHaveBeenCalled();
@@ -167,12 +171,16 @@ describe("tenant resource boundaries", () => {
const response = await request(`/task/move/${own.task.id}`, "PUT", {
destinationProjectId,
});
- responses.push({ status: response.status, body: await response.text() });
+ responses.push({
+ status: response.status,
+ body: await readErrorBody(response),
+ });
}
- expect(responses).toEqual([
- { status: 404, body: "Project not found" },
- { status: 404, body: "Project not found" },
- ]);
+ const notFound = {
+ status: 404,
+ body: { message: "Project not found", code: "NOT_FOUND" },
+ };
+ expect(responses).toEqual([notFound, notFound]);
expect(
await db.query.taskTable.findFirst({
where: eq(schema.taskTable.id, own.task.id),
diff --git a/tests/api-integration/workspace-rbac.test.ts b/tests/api-integration/workspace-rbac.test.ts
index cea4f1d47..fe0ad494f 100644
--- a/tests/api-integration/workspace-rbac.test.ts
+++ b/tests/api-integration/workspace-rbac.test.ts
@@ -9,6 +9,7 @@ import {
createProjectFixture,
createWorkspaceMember,
} from "./helpers/fixtures";
+import { readErrorBody } from "./helpers/error-body";
// Assignment notifications run in the background and can otherwise race the
// next test's TRUNCATE. Notification access/delivery has its own DB suite;
@@ -111,7 +112,11 @@ describe("API integration: workspace RBAC enforcement", () => {
const response = await postCreateTask(app, project.id);
expect(response.status).toBe(403);
- await expect(response.text()).resolves.toBe("Insufficient permissions");
+ expect(await readErrorBody(response)).toEqual({
+ message: "Insufficient permissions",
+ code: "MISSING_PERMISSION",
+ missingPermissions: ["task:create"],
+ });
const persisted = await db.query.taskTable.findFirst({
where: and(