Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 73 additions & 15 deletions lib/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3170,6 +3170,11 @@ export class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Command
// Keep received-but-unreadable bodies separate from requests that never
// received a response. The former used to be counted as "network".
const failed: UsageEndpointFailure[] = []
// Name the address every attempt actually used. A bare `/alpha/whoami`
// cannot tell a moved port from a wrong path, and behind a prefix reverse
// proxy the prefix is exactly the part that differs — the user's own
// ECONNREFUSED diagnosis needs scheme://host:port in the failure text.
const targetOf = (path: string): string => `${base.replace(/\/+$/, '')}${path}`

const getJson = async (path: string, share = true): Promise<Record<string, unknown> | undefined> => {
try {
Expand All @@ -3185,13 +3190,13 @@ export class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Command
share,
)
if (record === undefined) {
failures.push(`${path}: HTTP ${status}${responseFailure ? `;${responseFailure}` : ''}`)
failures.push(`${targetOf(path)}: HTTP ${status}${responseFailure ? `;${responseFailure}` : ''}`)
failed.push(responseFailure ? { kind: 'invalid-response', status } : { kind: 'http', status })
return undefined
}
return record
} catch (error: unknown) {
failures.push(`${path}: ${readableErrorText(error)}`)
failures.push(`${targetOf(path)}: ${readableErrorText(error)}`)
failed.push({ kind: 'transport' })
return undefined
}
Expand Down
Loading