How to handle ETIMEDOUT error?

后端 未结 3 512
感情败类
感情败类 2020-12-05 05:26

How to handle etimedout error on this call ?

 var remotePath = \"myremoteurltocopy\"
 var localStream = fs.createWriteStream(\"myfil\");;
        var out = r         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 05:39

    We could look at error object for a property code that mentions the possible system error and in cases of ETIMEDOUT where a network call fails, act accordingly.

    if (err.code === 'ETIMEDOUT') {
        console.log('My dish error: ', util.inspect(err, { showHidden: true, depth: 2 }));
    }
    

提交回复
热议问题