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

Lines changed: 2 additions & 4 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy