Socket
Socket
Sign inDemoInstall

async-try-catch

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-try-catch - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

package.json
{
"name": "async-try-catch",
"version": "0.1.2",
"version": "0.1.3",
"description": "Async try catch",

@@ -5,0 +5,0 @@ "main": "lib/AsyncTryCatch.js",

@@ -220,2 +220,4 @@ /*

} ) ;
it( "should resume the event emitting" ) ;
} ) ;

@@ -260,4 +262,58 @@

} ) ;
it( "should work using the listener object syntax" , function( done ) {
var emitter = Object.create( NextGenEvents.prototype ) ;
asyncTry( function() {
emitter.on( 'damage' , { fn: function() { throw new Error( 'argh!' ) ; } } ) ;
} )
.catch( function( error ) {
expect( error.message ).to.be( 'argh!' ) ;
done() ;
} ) ;
emitter.emit( 'damage' ) ;
} ) ;
it( "should work using the fn followed by an object syntax" , function( done ) {
var emitter = Object.create( NextGenEvents.prototype ) ;
asyncTry( function() {
emitter.on( 'damage' , function() { throw new Error( 'argh!' ) ; } , {} ) ;
} )
.catch( function( error ) {
expect( error.message ).to.be( 'argh!' ) ;
done() ;
} ) ;
emitter.emit( 'damage' ) ;
} ) ;
it( "should work with async listeners" , function( done ) {
var emitter = Object.create( NextGenEvents.prototype , function() {
console.log( 'Completed?' ) ;
} ) ;
asyncTry( function() {
emitter.on( 'damage' , {
async: true ,
fn: function() {
setTimeout( function() {
throw new Error( 'delayed argh!' ) ;
} ) ;
}
} ) ;
} )
.catch( function( error ) {
expect( error.message ).to.be( 'delayed argh!' ) ;
done() ;
} ) ;
emitter.emit( 'damage' ) ;
} ) ;
} ) ;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc