Giter Club home page Giter Club logo

Comments (6)

kartikk221 avatar kartikk221 commented on June 4, 2024 1

Interesting, I thought that

if (output instanceof Promise) output.catch(next);
would catch any Promise rejections from the route handler. Could you try forking and utlilizing this older wrapper
new Promise((resolve, reject) => {
to see If that catches your specific rejection?

from hyper-express.

kartikk221 avatar kartikk221 commented on June 4, 2024 1

Good catch, seems rejecting with a string was preventing it from being caught as it was not an Error type. The Response.throw() method expects an Error type, so I would assume we would have to wrap non Error type rejections but we would lose the stack trace of the rejection.

from hyper-express.

kartikk221 avatar kartikk221 commented on June 4, 2024 1

This issue has been fixed in the recently released v6.2.4 of HyperExpress. Let me know If you encounter any other issues.

from hyper-express.

ImLunaHey avatar ImLunaHey commented on June 4, 2024 1

Thank you so much, this works perfectly. 🥳

from hyper-express.

ImLunaHey avatar ImLunaHey commented on June 4, 2024

I'll give that a go today and let you know.

from hyper-express.

ImLunaHey avatar ImLunaHey commented on June 4, 2024

Oh found the issue.

// Never responds
webserver.get('/not-working', async () => {
    await new Promise((_resolve, reject) => {
        return reject('Hello World');
    });
});

// Responds
webserver.get('/working', async () => {
    await new Promise((_resolve, reject) => {
        return reject(new Error('Hello World')); // The new Error() is required otherwise it never finishes the request
    });
});

from hyper-express.

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.