javascript error

try {
    throw 'myException'
}
catch(e if e instanceof TypeError){
    console.log("first catch")
}
catch(e){
    console.log(e)
}
SyntaxError: Unexpected token if

node.js doesn't support the conditional catch

use this way

try{
}
catch(e){
if( e instanceof TypeErro){
  //
}

你可能感兴趣的:(javascript error)