@@ -32,6 +32,7 @@ import {
32
32
debugHttpError ,
33
33
} from './debug.mts'
34
34
import { buildErrorCause } from './errors.mts'
35
+ import { githubRepoLink , webLink } from './terminal-link.mts'
35
36
import constants , {
36
37
CONFIG_KEY_API_BASE_URL ,
37
38
EMPTY_VALUE ,
@@ -92,7 +93,9 @@ function logPermissionsFor403(cmdPath?: string | undefined): void {
92
93
}
93
94
logger . error ( '' )
94
95
logger . error ( '💡 To fix this:' )
95
- logger . error ( ' 1. Visit https://socket.dev/settings/api-tokens' )
96
+ logger . error (
97
+ ` 1. Visit ${ webLink ( 'https://socket.dev/settings/api-tokens' ) } ` ,
98
+ )
96
99
logger . error (
97
100
' 2. Edit your API token to grant the permissions listed above' ,
98
101
)
@@ -127,9 +130,9 @@ export async function getErrorMessageForHttpStatusCode(code: number) {
127
130
'❌ Access denied: Your API token lacks required permissions or organization access.\n' +
128
131
'💡 Try:\n' +
129
132
' • Run `socket whoami` to verify your account and organization\n' +
130
- ' • Check your API token permissions at https://socket.dev/settings/api-tokens\n' +
133
+ ` • Check your API token permissions at ${ webLink ( ' https://socket.dev/settings/api-tokens' ) } \n` +
131
134
" • Ensure you're accessing the correct organization with `--org` flag\n" +
132
- ' • Verify your plan includes this feature at https://socket.dev/pricing'
135
+ ` • Verify your plan includes this feature at ${ webLink ( ' https://socket.dev/pricing') } `
133
136
)
134
137
}
135
138
if ( code === HTTP_STATUS_NOT_FOUND ) {
@@ -139,14 +142,14 @@ export async function getErrorMessageForHttpStatusCode(code: number) {
139
142
' • Verify resource names (package, repository, organization)\n' +
140
143
' • Check if the resource was deleted or moved\n' +
141
144
' • Update to the latest CLI version: `socket self-update` (SEA) or `npm update -g socket`\n' +
142
- ' • Report persistent issues at https://github.com/ SocketDev/ socket-cli/ issues'
145
+ ` • Report persistent issues at ${ githubRepoLink ( ' SocketDev' , ' socket-cli' , ' issues') } `
143
146
)
144
147
}
145
148
if ( code === HTTP_STATUS_TOO_MANY_REQUESTS ) {
146
149
return (
147
150
'❌ Rate limit exceeded: Too many API requests.\n' +
148
151
'💡 Try:\n' +
149
- ' • Free plan: Wait a few minutes for quota reset or upgrade at https://socket.dev/pricing\n' +
152
+ ` • Free plan: Wait a few minutes for quota reset or upgrade at ${ webLink ( ' https://socket.dev/pricing' ) } \n` +
150
153
' • Paid plan: Contact support if rate limits seem incorrect\n' +
151
154
' • Check current quota: `socket organization quota`\n' +
152
155
' • Reduce request frequency or batch operations'
@@ -157,13 +160,13 @@ export async function getErrorMessageForHttpStatusCode(code: number) {
157
160
'❌ Server error: Socket API encountered an internal problem (HTTP 500).\n' +
158
161
'💡 Try:\n' +
159
162
' • Wait a few minutes and retry your command\n' +
160
- ' • Check Socket status: https://status.socket.dev\n' +
161
- ' • Report persistent issues: https://github.com/ SocketDev/ socket-cli/ issues'
163
+ ` • Check Socket status: ${ webLink ( ' https://status.socket.dev' ) } \n` +
164
+ ` • Report persistent issues: ${ githubRepoLink ( ' SocketDev' , ' socket-cli' , ' issues') } `
162
165
)
163
166
}
164
167
return (
165
168
`❌ HTTP ${ code } : Server responded with unexpected status code.\n` +
166
- ' 💡 Try: Check Socket status at https://status.socket.dev or report the issue.'
169
+ ` 💡 Try: Check Socket status at ${ webLink ( ' https://status.socket.dev' ) } or report the issue.`
167
170
)
168
171
}
169
172
0 commit comments