Skip to content

Commit d8edf06

Browse files
committed
Improve debug for getDefaultOrgSlug
1 parent e76e7ff commit d8edf06

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/commands/ci/fetch-default-org-slug.mts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ import type { CResult } from '../../types.mts'
1010
export async function getDefaultOrgSlug(): Promise<CResult<string>> {
1111
const defaultOrgResult = getConfigValueOrUndef('defaultOrg')
1212
if (defaultOrgResult) {
13-
debugFn('notice', 'use: default org', defaultOrgResult)
13+
debugFn(
14+
'notice',
15+
'use: org from defaultOrg value of socket/settings local app data',
16+
defaultOrgResult,
17+
)
1418
return { ok: true, data: defaultOrgResult }
1519
}
1620

1721
// Lazily access constants.ENV.SOCKET_CLI_ORG_SLUG.
1822
const envOrgSlug = constants.ENV.SOCKET_CLI_ORG_SLUG
1923
if (envOrgSlug) {
20-
debugFn('notice', 'use: org from environment variable', envOrgSlug)
24+
debugFn(
25+
'notice',
26+
'use: org from SOCKET_CLI_ORG_SLUG environment variable',
27+
envOrgSlug,
28+
)
2129
return { ok: true, data: envOrgSlug }
2230
}
2331

@@ -32,7 +40,7 @@ export async function getDefaultOrgSlug(): Promise<CResult<string>> {
3240
return {
3341
ok: false,
3442
message: 'Failed to establish identity',
35-
data: `API did not return any organization associated with the current API token. Unable to continue.`,
43+
data: `No organization associated with the API token. Unable to continue.`,
3644
}
3745
}
3846

@@ -41,11 +49,11 @@ export async function getDefaultOrgSlug(): Promise<CResult<string>> {
4149
return {
4250
ok: false,
4351
message: 'Failed to establish identity',
44-
data: `Was unable to determine the default organization for the current API token. Unable to continue.`,
52+
data: `Cannot determine the default organization for the API token. Unable to continue.`,
4553
}
4654
}
4755

48-
debugFn('notice', 'resolve: org', slug)
56+
debugFn('notice', 'resolve: org from API', slug)
4957

5058
return {
5159
ok: true,

0 commit comments

Comments
 (0)