Giter Club home page Giter Club logo

Comments (5)

gbin avatar gbin commented on June 17, 2024

Hi, can you try with my patch at #9 to see if it solves your problem ?

Thanks.

from flask-restful.

yaniv-aknin avatar yaniv-aknin commented on June 17, 2024

Thanks for the work @gbin, it indeed solves the bug as I originally reported it and I think this pull request should go in.

However, I think it's worthwhile to note that I think the correct behaviour should be:

  • error in API view with DEBUG=False: return error JSON
  • error in non-API view with DEBUG=False: return the app's error page (customized or not)
  • error in API view with DEBUG=True: return the werkzeug debugger; probably conditionally based on the Accept header in the request
  • error in non-API view with DEBUG=True: return the werkzeug debugger

I think the correct way to achieve this lies in making flask-restful a blueprint (or a blueprint factory? not sure about flask terminology yet) and use this API to catch only blueprint related errors.

from flask-restful.

gbin avatar gbin commented on June 17, 2024

I gonna look at how we can improve the solution from the same applications running on the same instance.

I investigated the Blueprint in order to do that and it looks interesting.
The problem is that you cannot handle at this point the 404 and 500 errors from them.

from flask-restful.

yaniv-aknin avatar yaniv-aknin commented on June 17, 2024

Indeed a substantial issue. I think one could argue that for 404 and 500 all you need is the HTTP status, disregarding body, but this is bending the spec to what we can easily implement rather than the other way round. Maybe there's a better way - I'm just too new to Flask.

from flask-restful.

yaniv-aknin avatar yaniv-aknin commented on June 17, 2024

I think this pull request should be where the rest of this discussion take place, so I'm closing this commit. Sorry for the mess - wasn't sure how to create a pull request and attach it to an existing issue without fiddling with GitHub's API.

from flask-restful.

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.