make-promises-safe | A node.js module to make the use of promises | Runtime Evironment library

 by   mcollina JavaScript Version: 5.1.0 License: MIT

kandi X-RAY | make-promises-safe Summary

kandi X-RAY | make-promises-safe Summary

make-promises-safe is a JavaScript library typically used in Server, Runtime Evironment, Nodejs applications. make-promises-safe has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can install using 'npm i make-promises-safe' or download it from GitHub, npm.

A node.js module to make the use of promises safe
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              make-promises-safe has a low active ecosystem.
              It has 586 star(s) with 21 fork(s). There are 14 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 1 open issues and 12 have been closed. On average issues are closed in 164 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of make-promises-safe is 5.1.0

            kandi-Quality Quality

              make-promises-safe has 0 bugs and 0 code smells.

            kandi-Security Security

              make-promises-safe has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              make-promises-safe code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              make-promises-safe is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              make-promises-safe releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed make-promises-safe and discovered the below as its top functions. This is intended to give you an instant insight into make-promises-safe implemented functionality, and help decide if they suit your requirements.
            • random stuff
            Get all kandi verified functions for this library.

            make-promises-safe Key Features

            No Key Features are available at this moment for make-promises-safe.

            make-promises-safe Examples and Code Snippets

            No Code Snippets are available at this moment for make-promises-safe.

            Community Discussions

            QUESTION

            Why is make-promises-safe only for use in "in top-level program code"
            Asked 2020-Sep-07 at 17:32

            The make-promises-safe package changes Node.js's default behavior with regards to errors thrown in promises. Normally, in Node, these unhandled promise rejections will be logged, but a program keeps on running. With make-promises-safe installed, Node.js will exit when it encounters an unhandled promise rejection. The "safe" here means that your program won't have secret unhandled rejections, since unhandled rejections often line up with resources that have not been properly cleaned up, and these non-cleaned up resources can cause problems in a long running program.

            All that I understand. However, this module comes with a warning

            It is important that this module is only used in top-level program code, not in reusable modules!

            The purpose of this warning is unclear. Why is it that the module authors advise folks against using this module in their own reusable modules?

            ...

            ANSWER

            Answered 2020-Sep-07 at 17:32

            I think the warning could indeed use some additional clarification if only to clarify the use of the slightly confusing terms of reusable modules and top-level program code here.

            When I read the warning I felt like it was warning against using it in packages/modules you publish to npm. When a user imports your npm package (which might be totally unrelated to error-handling) in which you required the make-promises-safe package, this would implicitly impose an error-handling mechanism the user might not be aware of. You could add this to your README file of course but not everybody reads those thoroughly.

            As you discussed in the comment section of your question already, the source code shows that it subscribes to the unhandledRejection event but even though it might not be as clean to require the make-promises-safe multiple times, the way it is declared, the module caching should indeed prevent the binding from happening more than once. So I would not count that as an issue. On the other hand, if every module started requiring make-promises-safe of course, there would be multiple subscriptions to the event.

            So, conclusion. I would only require make-promises-safe in the entry file of your node application (fe. app.js/server.js where your register create/configure your http server for a node web application), so, code you have control over yourself as the developer. I would not require it in any node module (be it locally or publicly on npm) and leave it to the user that implements your package how to handle errors in HIS application.

            Source https://stackoverflow.com/questions/63780374

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install make-promises-safe

            You can install using 'npm i make-promises-safe' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i make-promises-safe

          • CLONE
          • HTTPS

            https://github.com/mcollina/make-promises-safe.git

          • CLI

            gh repo clone mcollina/make-promises-safe

          • sshUrl

            git@github.com:mcollina/make-promises-safe.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link