Skip to content

Commit

Permalink
Fix error handling for messages sent over HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
man90es committed Nov 14, 2022
1 parent df97677 commit 8653f8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bakaso/fkclient",
"version": "1.3.1",
"version": "1.4.0",
"description": "A wrapper library for Foxtan API.",
"keywords": [
"foxtan",
Expand Down
10 changes: 1 addition & 9 deletions src/lib/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,7 @@ export default class Client {
})

return fetch(`${this.#APIServerURI.href}api/${path}`, options)
.then((response) => {
if (!response.ok) {
throw new Error(
`${response.status}: ${response.statusText}`
)
}

return response.json()
})
.then(response => response.json())
.then((data) => {
const dataWithoutError = { ...data }
delete dataWithoutError.error
Expand Down

0 comments on commit 8653f8a

Please sign in to comment.