Skip to content

Commit 628d1ba

Browse files
authored
fix: error codes after Graphite suggestions
1 parent 0043b24 commit 628d1ba

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

packages/cli/cli-v2/src/commands/sdk/generate/parseOutputArg.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ export function parseOutputArg(outputArg: string): schemas.OutputObjectSchema {
1313
if (isGitUrl(outputArg)) {
1414
const token = process.env.GITHUB_TOKEN ?? process.env.GIT_TOKEN;
1515
if (token == null) {
16+
1617
throw new CliError({
1718
message:
1819
`A git token is required when --output is a git URL.\n\n` +
1920
` Set GITHUB_TOKEN or GIT_TOKEN:\n` +
2021
` export GITHUB_TOKEN=ghp_xxx\n\n` +
2122
` Or use a local path:\n` +
2223
` --output ./my-sdk`,
23-
code: CliError.Code.InternalError
24+
code: CliError.Code.ConfigError
2425
});
26+
2527
}
2628
return {
2729
git: {

packages/cli/cli-v2/src/init/Wizard.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,10 +712,12 @@ export class Wizard {
712712
private async fetchApiFromUrl(url: string, specFormat: FernYmlBuilder.SpecFormat): Promise<Wizard.ApiSource> {
713713
const response = await fetch(url, { signal: AbortSignal.timeout(FETCH_API_SPEC_REQUEST_TIMEOUT_MS) });
714714
if (!response.ok) {
715+
715716
throw new CliError({
716717
message: `HTTP ${response.status} ${response.statusText}`,
717-
code: CliError.Code.InternalError
718+
code: CliError.Code.NetworkError
718719
});
720+
719721
}
720722
const content = await response.text();
721723
const filename = this.resolveFilenameFromUrl({ url, specFormat });

0 commit comments

Comments
 (0)