DEV Community

Discussion on: Do you know why we check for response.ok while using fetch

Collapse
 
bias profile image
Tobias Nickel • Edited

I think you forget one thing,...

the error is now the response object. it does not have message or a stack.
I thing if ok or not, you you should r
response.text() or json. and then create an error object.

Collapse
 
jessegilbride profile image
Jesse Gilbride

It should be logged, yes, but probably not terribly useful to the app user. Maybe better to send the log to the app maintainer.

Collapse
 
bias profile image
Tobias Nickel

it is useful, when you want to show the user some more specific error what went wrong. giving him a tip to resolve the issue himself, maybe create or update someother entity first.

I would think this is terribly useful.

Thread Thread
 
jessegilbride profile image
Jesse Gilbride • Edited

Right, useful to the programmer.