{"id":209,"date":"2026-07-18T09:27:54","date_gmt":"2026-07-18T01:27:54","guid":{"rendered":"https:\/\/yykcj.com\/?p=209"},"modified":"2026-07-18T09:27:54","modified_gmt":"2026-07-18T01:27:54","slug":"node-js-%e9%94%99%e8%af%af%e5%a4%84%e7%90%86%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5%ef%bc%9a%e4%bb%8e%e5%b4%a9%e6%ba%83%e5%88%b0%e4%bc%98%e9%9b%85%e9%99%8d%e7%ba%a7","status":"publish","type":"post","link":"https:\/\/yykcj.com\/?p=209","title":{"rendered":"Node.js \u9519\u8bef\u5904\u7406\u6700\u4f73\u5b9e\u8df5\uff1a\u4ece\u5d29\u6e83\u5230\u4f18\u96c5\u964d\u7ea7"},"content":{"rendered":"<h2>\u5f15\u8a00<\/h2>\n<p>\u5728 Node.js \u5f00\u53d1\u4e2d\uff0c\u9519\u8bef\u5904\u7406\u5f80\u5f80\u662f\u5bb9\u6613\u88ab\u5ffd\u89c6\u7684\u73af\u8282\u3002\u8bb8\u591a\u65b0\u624b\u5f00\u53d1\u8005\u4e60\u60ef\u4e8e\u7528 <code>try\/catch<\/code> \u5305\u88f9\u6240\u6709\u4ee3\u7801\uff0c\u6216\u8005\u5e72\u8106\u5ffd\u7565\u9519\u8bef\uff0c\u5bfc\u81f4\u751f\u4ea7\u73af\u5883\u51fa\u73b0\u672a\u6355\u83b7\u5f02\u5e38\u65f6\u8fdb\u7a0b\u5d29\u6e83\uff0c\u7528\u6237\u4f53\u9a8c\u6781\u5dee\u3002\u5b9e\u9645\u4e0a\uff0cNode.js \u7684\u9519\u8bef\u5904\u7406\u6709\u4e00\u5957\u6210\u719f\u7684\u6a21\u5f0f\uff0c\u9075\u5faa\u8fd9\u4e9b\u6700\u4f73\u5b9e\u8df5\u53ef\u4ee5\u8ba9\u4f60\u7684\u5e94\u7528\u5728\u51fa\u73b0\u610f\u5916\u65f6\u4f18\u96c5\u964d\u7ea7\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u6302\u6389\u3002<\/p>\n<p>\u672c\u6587\u5c06\u4ece\u57fa\u7840\u5230\u8fdb\u9636\uff0c\u5e26\u4f60\u638c\u63e1 Node.js \u9519\u8bef\u5904\u7406\u7684\u5b8c\u6574\u4f53\u7cfb\u3002<\/p>\n<h2>1. \u7406\u89e3 Node.js \u4e2d\u7684\u9519\u8bef\u7c7b\u578b<\/h2>\n<p>Node.js \u4e2d\u7684\u9519\u8bef\u4e3b\u8981\u5206\u4e3a\u4e24\u7c7b\uff1a<strong>\u7f16\u7a0b\u9519\u8bef<\/strong>\uff08\u7a0b\u5e8f\u5458 Bug\uff09\u548c <strong>\u64cd\u4f5c\u9519\u8bef<\/strong>\uff08\u8fd0\u884c\u65f6\u73af\u5883\u95ee\u9898\uff09\u3002<\/p>\n<ul>\n<li><strong>\u7f16\u7a0b\u9519\u8bef<\/strong>\uff1a\u4f8b\u5982\u8bed\u6cd5\u9519\u8bef\u3001\u7c7b\u578b\u9519\u8bef\u3001\u5f15\u7528\u7a7a\u503c\u7b49\u3002\u8fd9\u7c7b\u9519\u8bef\u5e94\u8be5\u901a\u8fc7\u4fee\u590d\u4ee3\u7801\u6765\u907f\u514d\u3002<\/li>\n<li><strong>\u64cd\u4f5c\u9519\u8bef<\/strong>\uff1a\u4f8b\u5982\u6587\u4ef6\u4e0d\u5b58\u5728\u3001\u7f51\u7edc\u8d85\u65f6\u3001\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u7b49\u3002\u8fd9\u7c7b\u9519\u8bef\u9700\u8981\u6b63\u786e\u5904\u7406\uff0c\u4ee5\u4fdd\u8bc1\u5e94\u7528\u7ee7\u7eed\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<p><strong>\u6700\u4f73\u5b9e\u8df5<\/strong>\uff1a\u59cb\u7ec8\u533a\u5206\u8fd9\u4e24\u79cd\u9519\u8bef\uff0c\u5bf9\u64cd\u4f5c\u9519\u8bef\u8fdb\u884c\u4f18\u96c5\u5904\u7406\uff0c\u5bf9\u7f16\u7a0b\u9519\u8bef\u5219\u5c3d\u5feb\u5931\u8d25\uff08fail-fast\uff09\u5e76\u4fee\u590d\u3002<\/p>\n<h2>2. \u540c\u6b65\u4ee3\u7801\u7684\u9519\u8bef\u5904\u7406<\/h2>\n<p>\u6700\u7b80\u5355\u7684\u9519\u8bef\u5904\u7406\u662f <code>try\/catch<\/code>\uff0c\u4f46\u8981\u6ce8\u610f\uff1a<code>try\/catch<\/code> \u53ea\u80fd\u6355\u83b7\u540c\u6b65\u4ee3\u7801\u4e2d\u7684\u5f02\u5e38\u3002<\/p>\n<pre><code class=\"language-javascript\">\n\/\/ \u540c\u6b65\u9519\u8bef\u5904\u7406\u793a\u4f8b\nfunction parseJSON(str) {\n    try {\n        return JSON.parse(str);\n    } catch (err) {\n        \/\/ \u8bb0\u5f55\u9519\u8bef\u65e5\u5fd7\n        console.error(&#x27;JSON \u89e3\u6790\u5931\u8d25:&#x27;, err.message);\n        \/\/ \u8fd4\u56de\u9ed8\u8ba4\u503c\u6216\u629b\u51fa\u81ea\u5b9a\u4e49\u9519\u8bef\n        return null;\n    }\n}\n\nconst result = parseJSON(&#x27;invalid json&#x27;);\nconsole.log(result); \/\/ null\n<\/code><\/pre>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u4e0d\u8981\u6ee5\u7528 <code>try\/catch<\/code> \u6355\u83b7\u6240\u6709\u9519\u8bef\u3002\u53ea\u6355\u83b7\u4f60\u9884\u671f\u4f1a\u53d1\u751f\u7684\u64cd\u4f5c\u9519\u8bef\uff0c\u8ba9\u7f16\u7a0b\u9519\u8bef\u66b4\u9732\u51fa\u6765\u3002<\/p>\n<h2>3. \u5f02\u6b65\u4ee3\u7801\u7684\u9519\u8bef\u5904\u7406\uff1a\u56de\u8c03\u3001Promise \u548c async\/await<\/h2>\n<h3>3.1 \u56de\u8c03\u98ce\u683c (callback)<\/h3>\n<p>\u65e9\u671f\u7684 Node.js \u4f7f\u7528\u56de\u8c03\u51fd\u6570\u5904\u7406\u5f02\u6b65\uff0c\u9519\u8bef\u4f18\u5148\u662f\u7ea6\u5b9a\u4fd7\u6210\u7684\u6a21\u5f0f\u3002<\/p>\n<pre><code class=\"language-javascript\">\nconst fs = require(&#x27;fs&#x27;);\n\nfs.readFile(&#x27;\/path\/to\/file&#x27;, (err, data) =&gt; {\n    if (err) {\n        \/\/ \u5904\u7406\u9519\u8bef\n        console.error(&#x27;\u8bfb\u53d6\u6587\u4ef6\u5931\u8d25:&#x27;, err.message);\n        return;\n    }\n    \/\/ \u5904\u7406\u6570\u636e\n    console.log(data.toString());\n});\n<\/code><\/pre>\n<p><strong>\u574f\u5473\u9053<\/strong>\uff1a\u5fd8\u8bb0\u68c0\u67e5 <code>err<\/code> \u53c2\u6570\uff0c\u6216\u8005\u56de\u8c03\u5d4c\u5957\u8fc7\u6df1\u5bfc\u81f4\u96be\u4ee5\u8ffd\u8e2a\u9519\u8bef\u3002<\/p>\n<h3>3.2 Promise \u94fe<\/h3>\n<p>Promise \u63d0\u4f9b\u4e86 <code>.catch()<\/code> \u65b9\u6cd5\u7edf\u4e00\u5904\u7406\u9519\u8bef\uff0c\u4f46\u8981\u6ce8\u610f\uff1a\u5982\u679c Promise \u94fe\u4e2d\u6ca1\u6709 <code>.catch()<\/code>\uff0c\u9519\u8bef\u4f1a\u88ab\u541e\u6389\u3002<\/p>\n<pre><code class=\"language-javascript\">\n\/\/ \u597d\u7684\u5b9e\u8df5\uff1a\u59cb\u7ec8\u5728\u94fe\u5c3e\u6dfb\u52a0 .catch()\nfetchData()\n    .then(processData)\n    .then(saveData)\n    .catch(err =&gt; {\n        console.error(&#x27;\u64cd\u4f5c\u5931\u8d25:&#x27;, err);\n        \/\/ \u53ef\u4ee5\u5728\u8fd9\u91cc\u8fdb\u884c\u91cd\u8bd5\u6216\u56de\u6eda\n    });\n<\/code><\/pre>\n<p><strong>\u5e38\u89c1\u5751<\/strong>\uff1a\u5728 <code>.then()<\/code> \u5185\u90e8\u629b\u51fa\u7684\u9519\u8bef\u5982\u679c\u6ca1\u6709\u88ab\u6355\u83b7\uff0c\u4f1a\u5bfc\u81f4\u672a\u5904\u7406\u7684 Promise rejection\u3002<\/p>\n<h3>3.3 async\/await \u4e0e try\/catch<\/h3>\n<p><code>async\/await<\/code> \u8ba9\u5f02\u6b65\u4ee3\u7801\u770b\u8d77\u6765\u50cf\u540c\u6b65\uff0c\u9519\u8bef\u5904\u7406\u4e5f\u56de\u5f52 <code>try\/catch<\/code>\u3002<\/p>\n<pre><code class=\"language-javascript\">\nasync function processUserData(userId) {\n    try {\n        const user = await fetchUser(userId);\n        const orders = await fetchOrders(user.id);\n        return { user, orders };\n    } catch (err) {\n        \/\/ \u7edf\u4e00\u5904\u7406\u7f51\u7edc\u9519\u8bef\u6216\u6570\u636e\u5e93\u9519\u8bef\n        console.error(&#x27;\u83b7\u53d6\u7528\u6237\u6570\u636e\u5931\u8d25:&#x27;, err);\n        throw new AppError(&#x27;USER_DATA_FETCH_FAILED&#x27;, &#x27;\u65e0\u6cd5\u83b7\u53d6\u7528\u6237\u6570\u636e&#x27;);\n    }\n}\n\n\/\/ \u8c03\u7528\u65b9\u4e5f\u9700\u8981\u5904\u7406\nasync function main() {\n    try {\n        const data = await processUserData(123);\n        console.log(data);\n    } catch (err) {\n        \/\/ \u8fd9\u91cc\u6355\u83b7\u5230\u81ea\u5b9a\u4e49\u9519\u8bef\n        console.error(err.message);\n    }\n}\n<\/code><\/pre>\n<p><strong>\u6700\u4f73\u5b9e\u8df5<\/strong>\uff1a\u5728 async \u51fd\u6570\u5185\u90e8\u4f7f\u7528 <code>try\/catch<\/code> \u6355\u83b7\u9884\u671f\u9519\u8bef\uff0c\u5e76\u8f6c\u6362\u4e3a\u81ea\u5b9a\u4e49\u9519\u8bef\u7c7b\u578b\uff08\u5982 <code>AppError<\/code>\uff09\uff0c\u65b9\u4fbf\u4e0a\u5c42\u7edf\u4e00\u5904\u7406\u3002<\/p>\n<h2>4. \u5168\u5c40\u672a\u6355\u83b7\u5f02\u5e38\u5904\u7406<\/h2>\n<p>\u5373\u4f7f\u6211\u4eec\u5c3d\u529b\u6355\u83b7\u6240\u6709\u9519\u8bef\uff0c\u4ecd\u7136\u53ef\u80fd\u51fa\u73b0\u672a\u6355\u83b7\u7684\u5f02\u5e38\u3002Node.js \u63d0\u4f9b\u4e86\u4e24\u4e2a\u5168\u5c40\u4e8b\u4ef6\uff1a<code>uncaughtException<\/code> \u548c <code>unhandledRejection<\/code>\u3002<\/p>\n<h3>4.1 \u5904\u7406\u672a\u6355\u83b7\u7684\u540c\u6b65\u5f02\u5e38<\/h3>\n<pre><code class=\"language-javascript\">\nprocess.on(&#x27;uncaughtException&#x27;, (err) =&gt; {\n    console.error(&#x27;\u672a\u6355\u83b7\u7684\u5f02\u5e38:&#x27;, err);\n    \/\/ \u8bb0\u5f55\u65e5\u5fd7\u540e\uff0c\u4f18\u96c5\u5173\u95ed\u5e94\u7528\n    gracefulShutdown();\n    \/\/ \u6ce8\u610f\uff1a\u4e0d\u63a8\u8350\u5728\u8fd9\u91cc\u6062\u590d\u8fd0\u884c\uff0c\u56e0\u4e3a\u5e94\u7528\u53ef\u80fd\u5904\u4e8e\u4e0d\u4e00\u81f4\u72b6\u6001\n});\n<\/code><\/pre>\n<p><strong>\u8b66\u544a<\/strong>\uff1a<code>uncaughtException<\/code> \u5e94\u8be5\u4ec5\u7528\u4e8e\u8bb0\u5f55\u65e5\u5fd7\u548c\u6e05\u7406\u8d44\u6e90\uff0c\u7136\u540e\u9000\u51fa\u8fdb\u7a0b\u3002\u4e0d\u8981\u8bd5\u56fe\u8ba9\u5e94\u7528\u7ee7\u7eed\u8fd0\u884c\uff0c\u5426\u5219\u53ef\u80fd\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u6216\u5176\u4ed6\u4e0d\u53ef\u9884\u77e5\u95ee\u9898\u3002<\/p>\n<h3>4.2 \u5904\u7406\u672a\u5904\u7406\u7684 Promise rejection<\/h3>\n<pre><code class=\"language-javascript\">\nprocess.on(&#x27;unhandledRejection&#x27;, (reason, promise) =&gt; {\n    console.error(&#x27;\u672a\u5904\u7406\u7684 Promise rejection:&#x27;, reason);\n    \/\/ \u540c\u6837\uff0c\u8bb0\u5f55\u65e5\u5fd7\u540e\u9000\u51fa\n    gracefulShutdown();\n});\n<\/code><\/pre>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u4ece Node.js 15 \u5f00\u59cb\uff0c\u672a\u5904\u7406\u7684 Promise rejection \u4f1a\u76f4\u63a5\u5bfc\u81f4\u8fdb\u7a0b\u9000\u51fa\u3002\u56e0\u6b64\u52a1\u5fc5\u786e\u4fdd\u6240\u6709 Promise \u90fd\u6709 <code>.catch()<\/code> \u6216 await \u5305\u88f9\u3002<\/p>\n<h2>5. \u6784\u5efa\u591a\u5c42\u9519\u8bef\u5904\u7406\u4e2d\u95f4\u4ef6\uff08Express \u793a\u4f8b\uff09<\/h2>\n<p>\u5728 Web \u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e2d\u95f4\u4ef6\u5206\u5c42\u5904\u7406\u9519\u8bef\u3002<\/p>\n<h3>5.1 \u81ea\u5b9a\u4e49\u9519\u8bef\u7c7b<\/h3>\n<pre><code class=\"language-javascript\">\nclass AppError extends Error {\n    constructor(statusCode, message, isOperational = true) {\n        super(message);\n        this.statusCode = statusCode;\n        this.isOperational = isOperational; \/\/ \u533a\u5206\u64cd\u4f5c\u9519\u8bef\u548c\u7f16\u7a0b\u9519\u8bef\n        Error.captureStackTrace(this, this.constructor);\n    }\n}\n<\/code><\/pre>\n<h3>5.2 \u5f02\u6b65\u9519\u8bef\u5305\u88c5\u5668<\/h3>\n<p>\u907f\u514d\u5728\u6bcf\u4e2a async \u8def\u7531\u4e2d\u91cd\u590d\u5199 <code>try\/catch<\/code>\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u88c5\u5668\u3002<\/p>\n<pre><code class=\"language-javascript\">\nconst asyncHandler = (fn) =&gt; (req, res, next) =&gt; {\n    Promise.resolve(fn(req, res, next)).catch(next);\n};\n\n\/\/ \u4f7f\u7528\napp.get(&#x27;\/user\/:id&#x27;, asyncHandler(async (req, res) =&gt; {\n    const user = await getUserById(req.params.id);\n    if (!user) {\n        throw new AppError(404, &#x27;\u7528\u6237\u672a\u627e\u5230&#x27;);\n    }\n    res.json(user);\n}));\n<\/code><\/pre>\n<h3>5.3 \u5168\u5c40\u9519\u8bef\u5904\u7406\u4e2d\u95f4\u4ef6<\/h3>\n<pre><code class=\"language-javascript\">\napp.use((err, req, res, next) =&gt; {\n    \/\/ \u5224\u65ad\u662f\u5426\u662f\u81ea\u5b9a\u4e49\u64cd\u4f5c\u9519\u8bef\n    if (err.isOperational) {\n        \/\/ \u8bb0\u5f55\u65e5\u5fd7\n        console.warn(&#x27;\u64cd\u4f5c\u9519\u8bef:&#x27;, err.message);\n        return res.status(err.statusCode).json({\n            error: err.message\n        });\n    }\n    \/\/ \u7f16\u7a0b\u9519\u8bef\uff1a\u8bb0\u5f55\u8be6\u7ec6\u65e5\u5fd7\uff0c\u8fd4\u56de\u901a\u7528\u9519\u8bef\u4fe1\u606f\n    console.error(&#x27;\u7f16\u7a0b\u9519\u8bef:&#x27;, err);\n    res.status(500).json({\n        error: &#x27;\u670d\u52a1\u5668\u5185\u90e8\u9519\u8bef&#x27;\n    });\n});\n<\/code><\/pre>\n<p><strong>\u4f18\u52bf<\/strong>\uff1a\u6240\u6709\u9519\u8bef\u96c6\u4e2d\u5904\u7406\uff0c\u4ee3\u7801\u5e72\u51c0\uff0c\u6613\u4e8e\u7ef4\u62a4\u3002<\/p>\n<h2>6. \u65e5\u5fd7\u8bb0\u5f55\u4e0e\u76d1\u63a7<\/h2>\n<p>\u9519\u8bef\u5904\u7406\u7684\u5173\u952e\u662f\u8bb0\u5f55\u8db3\u591f\u7684\u4fe1\u606f\u4ee5\u4fbf\u8c03\u8bd5\u3002\u63a8\u8350\u4f7f\u7528 <code>winston<\/code> \u6216 <code>pino<\/code> \u7b49\u65e5\u5fd7\u5e93\u3002<\/p>\n<pre><code class=\"language-javascript\">\nconst winston = require(&#x27;winston&#x27;);\n\nconst logger = winston.createLogger({\n    level: &#x27;error&#x27;,\n    format: winston.format.json(),\n    transports: [\n        new winston.transports.File({ filename: &#x27;error.log&#x27; }),\n        new winston.transports.Console({ format: winston.format.simple() })\n    ]\n});\n\n\/\/ \u5728\u9519\u8bef\u5904\u7406\u4e2d\u4f7f\u7528\nlogger.error(&#x27;\u9519\u8bef\u8be6\u60c5&#x27;, { error: err.message, stack: err.stack, requestId: req.id });\n<\/code><\/pre>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u4e0d\u8981\u5c06\u654f\u611f\u4fe1\u606f\uff08\u5982\u5bc6\u7801\u3001Token\uff09\u8bb0\u5f55\u5230\u65e5\u5fd7\u4e2d\u3002<\/p>\n<h2>7. \u91cd\u8bd5\u4e0e\u964d\u7ea7\u7b56\u7565<\/h2>\n<p>\u5bf9\u4e8e\u4e34\u65f6\u6027\u64cd\u4f5c\u9519\u8bef\uff08\u5982\u7f51\u7edc\u8d85\u65f6\uff09\uff0c\u53ef\u4ee5\u5b9e\u73b0\u91cd\u8bd5\u673a\u5236\u3002<\/p>\n<pre><code class=\"language-javascript\">\nasync function fetchWithRetry(url, retries = 3) {\n    for (let i = 0; i &lt; retries; i++) {\n        try {\n            const response = await fetch(url);\n            return response;\n        } catch (err) {\n            if (i === retries - 1) throw err; \/\/ \u6700\u540e\u4e00\u6b21\u5931\u8d25\u5219\u5411\u4e0a\u629b\u51fa\n            console.warn(`\u91cd\u8bd5\u7b2c ${i+1} \u6b21`);\n            await sleep(1000 * (i+1)); \/\/ \u6307\u6570\u9000\u907f\n        }\n    }\n}\n<\/code><\/pre>\n<p><strong>\u964d\u7ea7<\/strong>\uff1a\u5f53\u4f9d\u8d56\u670d\u52a1\u4e0d\u53ef\u7528\u65f6\uff0c\u8fd4\u56de\u7f13\u5b58\u6570\u636e\u6216\u9ed8\u8ba4\u503c\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<ol>\n<li><strong>\u533a\u5206\u9519\u8bef\u7c7b\u578b<\/strong>\uff1a\u7f16\u7a0b\u9519\u8bef\u5c3d\u5feb\u4fee\u590d\uff0c\u64cd\u4f5c\u9519\u8bef\u4f18\u96c5\u5904\u7406\u3002<\/li>\n<li><strong>\u7edf\u4e00\u9519\u8bef\u5904\u7406<\/strong>\uff1a\u4f7f\u7528\u81ea\u5b9a\u4e49\u9519\u8bef\u7c7b\u548c\u5168\u5c40\u4e2d\u95f4\u4ef6\u3002<\/li>\n<li><strong>\u6355\u83b7\u6240\u6709\u5f02\u5e38<\/strong>\uff1a\u5305\u62ec Promise rejection \u548c\u672a\u6355\u83b7\u5f02\u5e38\uff0c\u4f46\u4ec5\u7528\u4e8e\u8bb0\u5f55\u548c\u9000\u51fa\u3002<\/li>\n<li><strong>\u8bb0\u5f55\u65e5\u5fd7<\/strong>\uff1a\u8be6\u7ec6\u8bb0\u5f55\u9519\u8bef\u4e0a\u4e0b\u6587\uff0c\u4f46\u907f\u514d\u654f\u611f\u4fe1\u606f\u3002<\/li>\n<li><strong>\u8003\u8651\u91cd\u8bd5\u4e0e\u964d\u7ea7<\/strong>\uff1a\u63d0\u9ad8\u7cfb\u7edf\u97e7\u6027\u3002<\/li>\n<\/ol>\n<p>\u4e0b\u4e00\u6b65\uff0c\u4f60\u53ef\u4ee5\u63a2\u7d22\u5982\u4f55\u7ed3\u5408 APM\uff08\u5982 Sentry\uff09\u8fdb\u884c\u5b9e\u65f6\u9519\u8bef\u76d1\u63a7\uff0c\u6216\u8005\u5b66\u4e60\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u9519\u8bef\u4f20\u64ad\u6a21\u5f0f\u3002<\/p>\n<h2>\u5ef6\u4f38\u9605\u8bfb<\/h2>\n<ul>\n<li><a href=\"https:\/\/nodejs.org\/api\/errors.html\">Node.js \u5b98\u65b9\u6587\u6863 &#8211; Error<\/a><\/li>\n<li><a href=\"https:\/\/www.joyent.com\/node-js\/production\/design\/errors\">Joyent &#8211; Error Handling in Node.js<\/a><\/li>\n<li><a href=\"https:\/\/expressjs.com\/en\/guide\/error-handling.html\">Express \u9519\u8bef\u5904\u7406\u6587\u6863<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u6df1\u5165\u63a2\u8ba8 Node.js \u9519\u8bef\u5904\u7406\u7684\u6700\u4f73\u5b9e\u8df5\uff0c\u5305\u62ec\u540c\u6b65\/\u5f02\u6b65\u9519\u8bef\u6355\u83b7\u3001Promise \u5f02\u5e38\u5904\u7406\u3001\u5168\u5c40\u672a\u6355\u83b7\u5f02\u5e38\u3001\u4ee5\u53ca\u5982\u4f55\u6784\u5efa\u591a\u5c42\u9519\u8bef\u5904\u7406\u4e2d\u95f4\u4ef6\uff0c\u8ba9\u5e94\u7528\u5728\u6545\u969c\u65f6\u4f9d\u7136\u7a33\u5065\u8fd0\u884c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[44,5,66,10,45,144],"class_list":["post-209","post","type-post","status-publish","format-standard","hentry","category-3","category-4","tag-express","tag-node-js","tag-66","tag-10","tag-45","tag-144"],"_links":{"self":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209"}],"version-history":[{"count":0,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/209\/revisions"}],"wp:attachment":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}