Closed keithjgrant closed 6 years ago
Yeah I just started noticing that too. It is because I didn't realise fetch
will still resolve even if the http status is an error. I guess I may have to check the status codes in my micropub library
Yeah, fetch only "fails" if the network request itself actually fails. You have to handle HTTP response codes separately. Make sure the micropub library exposes the response code somehow, so I can distinguish 500 codes from 400 codes.
Ok I have a new version of the micropub-helper
library up on npm (1.2.1)
In this version it will throw errors if the endpoint doesn't return a 2xx status code.
Errors now come as objects like this:
{
message: 'Human readable string',
status: null or the http status code,
error: null or further error information,
}
So you will be able to read if err.status
is a 400 or 500 and do whatever you want.
Just let me know if you run into any problems or have questions.
So the micropub-helper
update means that this will default to being an error and omnibear will flash the error message
Marking this resolved. I believe it's working now.
I got a 500 from my micropub endpoint, but it displayed the normal "successfully posted" message, which is obviously incorrect. Something is slipping through the error handling for that request.