AirJD 焦点
AirJD

没有录音文件
00:00/00:00
加收藏

Node Error Handling

发布者 noder
发布于 1481866626146  浏览 4725 关键词 Node.JS 
分享到

第1页

Node.js

——



第2页



• 20 • Node.js • LeanCloud • https://jysperm.me • GitHub: jysperm



第3页

• • •



第4页



• HTTP

• • •



第5页

Dispatcher Routers UI CLI



… Business Logic





Data Access

Database HTTP Client



第6页

Exception



第7页

Stack Trace

Error: some error at step2 (~/exception.js:14:9) at step1 (~/exception.js:9:3) at <anonymous> (~/exception.js:2:3)

step1: step2: some error



第8页



throw

• JavaScript



第9页

throw Exception



• throw

• •



Error *



第10页





第11页

Asynchronous

• Node.js style callback • Promise co/generator async/await • EventEmitter Stream



第12页

Expected



Actual



第13页

Node.js style callback



第15页



• err return



• callback



第16页

Promise



第17页

• Promise



第18页

• Promise



callback



第19页

co/generator



第20页

async/await



第21页

• Promise

Promise



async/await



第22页

Async Stack Trace

Without async stack trace:

Error: EACCES: permission denied, open 'to' at Error (native)

Enabled async stack trace:

Error: EACCES: permission denied, open 'to' at Error (native)

From previous event: at ~/test.js:15:15 at FSReqWrap.readFileAfterClose(fs.js:380:3)

From previous event: at copyFileContent (~/test.js:14:28) at ~/test.js:20:10



第23页

Error: EACCES: permission denied, open 'to' at Error (native)

From previous event: at ~/test.js:15:15 at FSReqWrap.readFileAfterClose(fs.js:380:3)

From previous event: at copyFileContent (~/test.js:14:28) at ~/test.js:20:10



第24页

EventEmitter



第25页

Stream



第26页

uncaughtException unhandledRejection



第27页

• Promise / callback chain •*

*



• err



第28页





第29页





第30页





第31页





第32页

• Routers Web-backend • UI Layer Web/Desktop App • Command Dispatcher CLI Tools



第33页









HTTP



Web-backend



• CLI Tools







第34页

Express



第35页

Sentry



第36页



• Promise

• •



第37页

Q&A

• Node.js • Docker • LeanCloud • Bitcoin • GPG



支持文件格式:*.pdf
上传最后阶段需要进行在线转换,可能需要1~2分钟,请耐心等待。