From 4386b7c96b5b556a036204415a88f0ea376bf762 Mon Sep 17 00:00:00 2001 From: Stan Wohlwend Date: Wed, 24 Jul 2024 12:31:36 -0700 Subject: [PATCH] Improve KnownError messages --- packages/stack-shared/src/known-errors.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/stack-shared/src/known-errors.tsx b/packages/stack-shared/src/known-errors.tsx index 3266ff68f..27cf499de 100644 --- a/packages/stack-shared/src/known-errors.tsx +++ b/packages/stack-shared/src/known-errors.tsx @@ -285,7 +285,11 @@ const AccessTypeWithoutProjectId = createKnownErrorConstructor( "ACCESS_TYPE_WITHOUT_PROJECT_ID", (accessType: "client" | "server" | "admin") => [ 400, - `The x-stack-access-type header was '${accessType}', but the x-stack-project-id header was not provided.`, + deindent` + The x-stack-access-type header was '${accessType}', but the x-stack-project-id header was not provided. + + For more information, see the docs on REST API authentication: https://docs.stack-auth.com/rest-api/auth#authentication + `, { request_type: accessType, }, @@ -298,7 +302,11 @@ const AccessTypeRequired = createKnownErrorConstructor( "ACCESS_TYPE_REQUIRED", () => [ 400, - `You must specify an access level for this Stack project. Make sure project API keys are provided (eg. x-stack-publishable-client-key) and you set the x-stack-access-type header to 'client', 'server', or 'admin'.`, + deindent` + You must specify an access level for this Stack project. Make sure project API keys are provided (eg. x-stack-publishable-client-key) and you set the x-stack-access-type header to 'client', 'server', or 'admin'. + + For more information, see the docs on REST API authentication: https://docs.stack-auth.com/rest-api/auth#authentication + `, ] as const, () => [] as const, );