{"id":36104,"date":"2024-11-26T11:10:36","date_gmt":"2024-11-26T03:10:36","guid":{"rendered":"https:\/\/fwq.ai\/blog\/36104\/"},"modified":"2024-11-26T11:10:36","modified_gmt":"2024-11-26T03:10:36","slug":"exceptionhandler-%e5%85%a8%e5%b1%80%e5%bc%82%e5%b8%b8%e5%a4%84%e7%90%86%e6%8d%95%e8%8e%b7%e4%ba%86%e5%bc%82%e5%b8%b8%ef%bc%8c%e4%bd%86%e4%b8%ba%e4%bb%80%e4%b9%88-try-catch-%e8%af%ad%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/36104\/","title":{"rendered":"@ExceptionHandler \u5168\u5c40\u5f02\u5e38\u5904\u7406\u6355\u83b7\u4e86\u5f02\u5e38\uff0c\u4f46\u4e3a\u4ec0\u4e48 try&#8230;catch \u8bed\u53e5\u5374\u65e0\u6cd5\u6355\u6349\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173095923695424.jpg\" class=\"aligncenter\" title=\"@ExceptionHandler \u5168\u5c40\u5f02\u5e38\u5904\u7406\u6355\u83b7\u4e86\u5f02\u5e38\uff0c\u4f46\u4e3a\u4ec0\u4e48 try&#8230;catch \u8bed\u53e5\u5374\u65e0\u6cd5\u6355\u6349\uff1f\u63d2\u56fe\" alt=\"@ExceptionHandler \u5168\u5c40\u5f02\u5e38\u5904\u7406\u6355\u83b7\u4e86\u5f02\u5e38\uff0c\u4f46\u4e3a\u4ec0\u4e48 try&#8230;catch \u8bed\u53e5\u5374\u65e0\u6cd5\u6355\u6349\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5f02\u5e38\u88ab @ExcepionHandler \u5168\u5c40\u5f02\u5e38\u5904\u7406\u6355\u83b7\uff0c\u4f46\u672a\u88ab catch \u6355\u83b7<\/strong><\/p>\n<p>\u5728\u672c\u6587\u63d0\u4f9b\u7684\u5f02\u5e38\u6808\u4fe1\u606f\u4e2d\uff0c\u5f02\u5e38\u662f\u4ece com.yhl.sys.bpm.service.impl.WpServiceImpl.startWp(WpServiceImpl.java:329) \u65b9\u6cd5\u4e2d\u629b\u51fa\u7684\u3002\u4f46\u662f\uff0c\u8be5\u65b9\u6cd5\u4e2d\u6dfb\u52a0\u7684 try&#8230;catch \u8bed\u53e5\u672a\u80fd\u6355\u83b7\u5f02\u5e38\u3002<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u9700\u8981\u786e\u8ba4 try&#8230;catch \u8bed\u53e5\u7684\u8bed\u6cd5\u662f\u5426\u6b63\u786e\uff0c\u5e76\u4e14\u786e\u4fdd\u5c06\u5f02\u5e38\u7c7b\u6b63\u786e\u6dfb\u52a0\u5230 catch \u5757\u4e2d\u3002\u8c03\u8bd5\u6b64\u95ee\u9898\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li> <strong>\u9a8c\u8bc1 try&#8230;catch \u8bed\u6cd5\u7684\u6b63\u786e\u6027\uff1a<\/strong>\u786e\u4fdd try&#8230;catch \u8bed\u53e5\u7684\u8bed\u6cd5\u7b26\u5408 Java \u8bed\u8a00\u89c4\u8303\uff0c\u4f8b\u5982\uff0c\u62ec\u53f7\u662f\u5426\u6b63\u786e\u653e\u7f6e\u3002<\/li>\n<li> <strong>\u786e\u5b9a\u5f02\u5e38\u7c7b\uff1a<\/strong>\u4ece\u5f02\u5e38\u6808\u4e2d\uff0c\u53d1\u73b0\u629b\u51fa\u7684\u5f02\u5e38\u662f FlowableException\u3002\u56e0\u6b64\uff0ccatch \u5757\u5e94\u5982\u4e0b\u6240\u793a\uff1acatch (FlowableException e)\u3002<\/li>\n<li> <strong>\u68c0\u67e5\u6355\u83b7\u8303\u56f4\uff1a<\/strong>\u786e\u4fdd try&#8230;catch \u8bed\u53e5\u5305\u542b\u629b\u51fa\u5f02\u5e38\u7684\u4ee3\u7801\u884c\u3002<\/li>\n<li> <strong>\u68c0\u67e5\u5176\u4ed6\u5f02\u5e38\u5904\u7406\u673a\u5236\uff1a<\/strong>\u5728 try&#8230;catch \u5757\u4e4b\u5916\uff0c\u53ef\u80fd\u8fd8\u6709\u5176\u4ed6\u5f02\u5e38\u5904\u7406\u4ee3\u7801\uff08\u4f8b\u5982 @ExceptionHandler \u6ce8\u89e3\uff09\u3002\u68c0\u67e5\u8fd9\u4e9b\u673a\u5236\u662f\u5426\u4f1a\u62e6\u622a\u5f02\u5e38\uff0c\u5bfc\u81f4 try&#8230;catch \u5757\u65e0\u6cd5\u6355\u83b7\u5b83\u3002<\/li>\n<\/ol>\n<p>\u5982\u679c\u9075\u5faa\u4e0a\u8ff0\u6b65\u9aa4\u540e\u4ecd\u7136\u65e0\u6cd5\u6355\u83b7\u5f02\u5e38\uff0c\u8bf7\u8003\u8651\u67e5\u770b\u5e95\u5c42\u6846\u67b6\u6216\u5e93\uff0c\u56e0\u4e3a\u5b83\u4eec\u53ef\u80fd\u63d0\u4f9b\u4e86\u81ea\u5df1\u7684\u5f02\u5e38\u5904\u7406\u673a\u5236\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f@ExceptionHandler \u5168\u5c40\u5f02\u5e38\u5904\u7406\u6355\u83b7\u4e86\u5f02\u5e38\uff0c\u4f46\u4e3a\u4ec0\u4e48 try&#8230;catch \u8bed\u53e5\u5374\u65e0\u6cd5\u6355\u6349\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f02\u5e38\u88ab @ExcepionHandler \u5168\u5c40\u5f02\u5e38\u5904\u7406\u6355\u83b7\uff0c\u4f46\u672a\u88ab catch \u6355\u83b7 \u5728\u672c\u6587\u63d0\u4f9b\u7684\u5f02\u5e38\u6808\u4fe1\u606f\u4e2d\uff0c\u5f02\u5e38\u662f\u4ece com.yhl.sys.bpm.service.impl.WpServiceImpl.startWp(WpServiceImpl.java:329) \u65b9\u6cd5\u4e2d\u629b\u51fa\u7684\u3002\u4f46\u662f\uff0c\u8be5\u65b9\u6cd5\u4e2d\u6dfb\u52a0\u7684 try&#8230;catch \u8bed\u53e5\u672a\u80fd\u6355\u83b7\u5f02\u5e38\u3002 \u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u9700\u8981\u786e\u8ba4 try&#8230;catch \u8bed\u53e5\u7684\u8bed\u6cd5\u662f\u5426\u6b63\u786e\uff0c\u5e76\u4e14\u786e\u4fdd\u5c06\u5f02\u5e38\u7c7b\u6b63\u786e\u6dfb\u52a0\u5230 catch \u5757\u4e2d\u3002\u8c03\u8bd5\u6b64\u95ee\u9898\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a \u9a8c\u8bc1 try&#8230;catch \u8bed\u6cd5\u7684\u6b63\u786e\u6027\uff1a\u786e\u4fdd try&#8230;catch \u8bed\u53e5\u7684\u8bed\u6cd5\u7b26\u5408 Java \u8bed\u8a00\u89c4\u8303\uff0c\u4f8b\u5982\uff0c\u62ec\u53f7\u662f\u5426\u6b63\u786e\u653e\u7f6e\u3002 \u786e\u5b9a\u5f02\u5e38\u7c7b\uff1a\u4ece\u5f02\u5e38\u6808\u4e2d\uff0c\u53d1\u73b0\u629b\u51fa\u7684\u5f02\u5e38\u662f FlowableException\u3002\u56e0\u6b64\uff0ccatch \u5757\u5e94\u5982\u4e0b\u6240\u793a\uff1acatch (FlowableException e)\u3002 \u68c0\u67e5\u6355\u83b7\u8303\u56f4\uff1a\u786e\u4fdd try&#8230;catch \u8bed\u53e5\u5305\u542b\u629b\u51fa\u5f02\u5e38\u7684\u4ee3\u7801\u884c\u3002 \u68c0\u67e5\u5176\u4ed6\u5f02\u5e38\u5904\u7406\u673a\u5236\uff1a\u5728 try&#8230;catch \u5757\u4e4b\u5916\uff0c\u53ef\u80fd\u8fd8\u6709\u5176\u4ed6\u5f02\u5e38\u5904\u7406\u4ee3\u7801\uff08\u4f8b\u5982 @ExceptionHandler \u6ce8\u89e3\uff09\u3002\u68c0\u67e5\u8fd9\u4e9b\u673a\u5236\u662f\u5426\u4f1a\u62e6\u622a\u5f02\u5e38\uff0c\u5bfc\u81f4 try&#8230;catch \u5757\u65e0\u6cd5\u6355\u83b7\u5b83\u3002 \u5982\u679c\u9075\u5faa\u4e0a\u8ff0\u6b65\u9aa4\u540e\u4ecd\u7136\u65e0\u6cd5\u6355\u83b7\u5f02\u5e38\uff0c\u8bf7\u8003\u8651\u67e5\u770b\u5e95\u5c42\u6846\u67b6\u6216\u5e93\uff0c\u56e0\u4e3a\u5b83\u4eec\u53ef\u80fd\u63d0\u4f9b\u4e86\u81ea\u5df1\u7684\u5f02\u5e38\u5904\u7406\u673a\u5236\u3002 \u4ee5\u4e0a\u5c31\u662f@ExceptionHandler \u5168\u5c40\u5f02\u5e38\u5904\u7406\u6355\u83b7\u4e86\u5f02\u5e38\uff0c\u4f46\u4e3a\u4ec0\u4e48 try&#8230;catch \u8bed\u53e5\u5374\u65e0\u6cd5\u6355\u6349\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-36104","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=36104"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36104\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=36104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=36104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=36104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}