Skip to content

Commit

Permalink
Fix error handle (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
novalisdenahi authored Aug 10, 2023
1 parent 0963d24 commit 6dc50b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/error-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import * as vscode from 'vscode';
export async function handleError(errorTitle: string, error: any): Promise<void> {
let errorDetails = '';
if (error?.response?.body) {
for (const [p, val] of Object.entries(error?.response?.body)) {
errorDetails += `${p}: ${val}\n`;

if (typeof error?.response?.body == "string") {
errorDetails = error?.response?.body;
} else {
for (const [p, val] of Object.entries(error?.response?.body)) {
errorDetails += `${p}: ${val}\n`;
}
}
}

Expand Down

0 comments on commit 6dc50b9

Please sign in to comment.