mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-01 19:25:10 +02:00
fix: user-friendly error when OpenAI org is not verified (#776)
Merged via PR triage plan. Friendly error for unverified OpenAI org. Follow-up: expand to evolve.ts, iterate.ts, variants.ts, check.ts.
This commit is contained in:
@@ -60,7 +60,14 @@ async function callImageGeneration(
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.text();
|
||||
throw new Error(`API error (${response.status}): ${error}`);
|
||||
if (response.status === 403 && error.includes("organization must be verified")) {
|
||||
throw new Error(
|
||||
"OpenAI organization verification required.\n"
|
||||
+ "Go to https://platform.openai.com/settings/organization to verify.\n"
|
||||
+ "After verification, wait up to 15 minutes for access to propagate.",
|
||||
);
|
||||
}
|
||||
throw new Error(`API error (${response.status}): ${error.slice(0, 200)}`);
|
||||
}
|
||||
|
||||
const data = await response.json() as any;
|
||||
|
||||
Reference in New Issue
Block a user