Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

chore: serialize when logging errors (#2775)

Akash K971238cedb28
diff --git a/packages/hoppscotch-app/src/helpers/teams/TeamCollectionAdapter.ts b/packages/hoppscotch-app/src/helpers/teams/TeamCollectionAdapter.ts
index ae85144d4..49a891bde 100644
--- a/packages/hoppscotch-app/src/helpers/teams/TeamCollectionAdapter.ts
+++ b/packages/hoppscotch-app/src/helpers/teams/TeamCollectionAdapter.ts
@@ -470,7 +470,9 @@ export default class NewTeamCollectionAdapter {
this.teamCollectionAdded$ = teamCollAdded$.subscribe((result) => {
if (E.isLeft(result))
- throw new Error(`Team Collection Added Error: ${result.left}`)
+ throw new Error(
+ `Team Collection Added Error: ${JSON.stringify(result.left)}`
+ )
this.addCollection(
{
@@ -493,7 +495,9 @@ export default class NewTeamCollectionAdapter {
this.teamCollectionUpdatedSub = teamCollUpdatedSub
this.teamCollectionUpdated$ = teamCollUpdated$.subscribe((result) => {
if (E.isLeft(result))
- throw new Error(`Team Collection Updated Error: ${result.left}`)
+ throw new Error(
+ `Team Collection Updated Error: ${JSON.stringify(result.left)}`
+ )
this.updateCollection({
id: result.right.teamCollectionUpdated.id,
@@ -511,7 +515,9 @@ export default class NewTeamCollectionAdapter {
this.teamCollectionRemovedSub = teamCollRemovedSub
this.teamCollectionRemoved$ = teamCollRemoved$.subscribe((result) => {
if (E.isLeft(result))
- throw new Error(`Team Collection Removed Error: ${result.left}`)
+ throw new Error(
+ `Team Collection Removed Error: ${JSON.stringify(result.left)}`
+ )
this.removeCollection(result.right.teamCollectionRemoved)
})
@@ -526,7 +532,9 @@ export default class NewTeamCollectionAdapter {
this.teamRequestAddedSub = teamReqAddedSub
this.teamRequestAdded$ = teamReqAdded$.subscribe((result) => {
if (E.isLeft(result))
- throw new Error(`Team Request Added Error: ${result.left}`)
+ throw new Error(
+ `Team Request Added Error: ${JSON.stringify(result.left)}`
+ )
this.addRequest({
id: result.right.teamRequestAdded.id,
@@ -548,7 +556,9 @@ export default class NewTeamCollectionAdapter {
this.teamRequestUpdatedSub = teamReqUpdatedSub
this.teamRequestUpdated$ = teamReqUpdated$.subscribe((result) => {
if (E.isLeft(result))
- throw new Error(`Team Request Updated Error: ${result.left}`)
+ throw new Error(
+ `Team Request Updated Error: ${JSON.stringify(result.left)}`
+ )
this.updateRequest({
id: result.right.teamRequestUpdated.id,
@@ -568,7 +578,9 @@ export default class NewTeamCollectionAdapter {
this.teamRequestUpdatedSub = teamReqDeleted
this.teamRequestDeleted$ = teamReqDeleted$.subscribe((result) => {
if (E.isLeft(result))
- throw new Error(`Team Request Deleted Error ${result.left}`)
+ throw new Error(
+ `Team Request Deleted Error ${JSON.stringify(result.left)}`
+ )
this.removeRequest(result.right.teamRequestDeleted)
})
diff --git a/packages/hoppscotch-app/src/helpers/teams/TeamListAdapter.ts b/packages/hoppscotch-app/src/helpers/teams/TeamListAdapter.ts
index 16db0acb1..de9c52803 100644
--- a/packages/hoppscotch-app/src/helpers/teams/TeamListAdapter.ts
+++ b/packages/hoppscotch-app/src/helpers/teams/TeamListAdapter.ts
@@ -65,7 +65,9 @@ export default class TeamListAdapter {
if (E.isLeft(result)) {
this.error$.next(result.left)
- throw new Error(`Failed fetching teams list: ${result.left}`)
+ throw new Error(
+ `Failed fetching teams list: ${JSON.stringify(result.left)}`
+ )
}
results.push(...result.right.myTeams)