Skip to content

Commit 4b47889

Browse files
committed
fix: return error response as JSON objects
Use JSON objects instead of arrays.
1 parent 391d887 commit 4b47889

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/api/policies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ router.post('/', async (req, res) => {
4747
} catch (error) {
4848
// For this one, we always want to give back the error to the customer
4949
console.log('POST error!', error)
50-
res.status(200).json([{ error: error.toString(), status: 200 }])
50+
res.status(200).json({ error: error.toString(), status: 200 })
5151
}
5252
})
5353

@@ -84,7 +84,7 @@ router.patch('/:id', async (req, res) => {
8484
} catch (error) {
8585
// For this one, we always want to give back the error to the customer
8686
console.log('Soft error!', error)
87-
res.status(200).json([{ error: error.toString(), status: 200 }])
87+
res.status(200).json({ error: error.toString(), status: 200 })
8888
}
8989
})
9090

src/api/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ router.post('/', async (req, res) => {
1111
} catch (error) {
1212
// For this one, we always want to give back the error to the customer
1313
console.log('Soft error!', error)
14-
res.status(200).json([{ error: error.toString(), status: 200 }])
14+
res.status(200).json({ error: error.toString(), status: 200 })
1515
}
1616
})
1717

src/api/tables.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ router.post('/', async (req, res) => {
6565
} catch (error) {
6666
// For this one, we always want to give back the error to the customer
6767
console.log('Soft error!', error)
68-
res.status(200).json([{ error: error.toString(), status: 200 }])
68+
res.status(200).json({ error: error.toString(), status: 200 })
6969
}
7070
})
7171

@@ -100,7 +100,7 @@ router.patch('/:id', async (req, res) => {
100100
} catch (error) {
101101
// For this one, we always want to give back the error to the customer
102102
console.log('Soft error!', error)
103-
res.status(200).json([{ error: error.toString(), status: 200 }])
103+
res.status(200).json({ error: error.toString(), status: 200 })
104104
}
105105
})
106106

0 commit comments

Comments
 (0)