Giter VIP home page Giter VIP logo

Comments (5)

grantcodes avatar grantcodes commented on June 12, 2024

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

from omnibear.

keithjgrant avatar keithjgrant commented on June 12, 2024

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.

from omnibear.

grantcodes avatar grantcodes commented on June 12, 2024

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.

from omnibear.

grantcodes avatar grantcodes commented on June 12, 2024

So the micropub-helper update means that this will default to being an error and omnibear will flash the error message

from omnibear.

keithjgrant avatar keithjgrant commented on June 12, 2024

Marking this resolved. I believe it's working now.

from omnibear.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.