Skip to content

Commit 0c75216

Browse files
authored
Fix "undefined" in error message (#132)
1 parent 9a80434 commit 0c75216

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/commands.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ export class Commands {
5858
return undefined
5959
})
6060
.catch((err) => {
61-
let message = err
62-
if (axios.isAxiosError(err) && err.response?.data) {
63-
message = err.response.data.detail
64-
}
6561
if (err instanceof CertificateError) {
6662
err.showNotification()
6763

@@ -72,6 +68,8 @@ export class Commands {
7268
}
7369
// This could be something like the header command erroring or an
7470
// invalid session token.
71+
const message =
72+
err?.response?.data?.detail || err?.message || err?.response?.status || "no response from the server"
7573
return {
7674
message: "Failed to authenticate: " + message,
7775
severity: vscode.InputBoxValidationSeverity.Error,

0 commit comments

Comments
 (0)