text: "use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[3043],{3905:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return m}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,l(l({ref:t},s),{},{components:n})):r.createElement(f,l({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,l=new Array(a);l[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var c=2;c<a;c++)l[c]=n[c];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},2266:function(e,t,n){n.r(t),n.d(t,{frontMatter:function(){return i},contentTitle:function(){return p},metadata:function(){return c},toc:function(){return s},default:function(){return d}});var r=n(3117),o=n(102),a=(n(7294),n(3905)),l=["components"],i={id:"oops",title:"4. Oops \u9759\u6001\u7c7b",sidebar_label:"4. Oops \u9759\u6001\u7c7b"},p=void 0,c={unversionedId:"global/oops",id:"global/oops",title:"4. Oops \u9759\u6001\u7c7b",description:"4.1 \u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38",source:"@site/docs/global/oops.mdx",sourceDirName:"global",slug:"/global/oops",permalink:"/furion/docs/global/oops",editUrl:"https://gitee.com/dotnetchina/Furion/tree/net6/handbook/docs/global/oops.mdx",tags:[],version:"current",lastUpdatedBy:"Monk",lastUpdatedAt:1628504616,formattedLastUpdatedAt:"8/9/2021",frontMatter:{id:"oops",title:"4. Oops \u9759\u6001\u7c7b",sidebar_label:"4. Oops \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"3. DataValidator \u9759\u6001\u7c7b",permalink:"/furion/docs/global/datavalidator"},next:{title:"5. LinqExpression \u9759\u6001\u7c7b",permalink:"/furion/docs/global/linqexpression"}},s=[{value:"4.1 \u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38",id:"41-\u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38",children:[],level:2},{value:"4.2 \u6307\u5b9a\u7c7b\u578b\u7684\u5f02\u5e38",id:"42-\u6307\u5b9a\u7c7b\u578b\u7684\u5f02\u5e38",children:[],level:2},{value:"4.3 \u72b6\u6001\u7801\u5f02\u5e38",id:"43-\u72b6\u6001\u7801\u5f02\u5e38",children:[],level:2},{value:"4.4 \u72b6\u6001\u7801\u5f02\u5e38",id:"44-\u72b6\u6001\u7801\u5f02\u5e38",children:[],level:2},{value:"4.5 \u5f02\u5e38\u65b9\u6cd5\u91cd\u8bd5",id:"45-\u5f02\u5e38\u65b9\u6cd5\u91cd\u8bd5",children:[],level:2},{value:"4.6 \u629b\u51fa\u4e1a\u52a1\u5f02\u5e38",id:"46-\u629b\u51fa\u4e1a\u52a1\u5f02\u5e38",children:[],level:2}],u={toc:s};function d(e){var t=e.components,n=(0,o.Z)(e,l);return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"41-\u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38"},"4.1 \u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cs"},'throw Oops.Oh("\u5f02\u5e38\u6d88\u606f");\nthrow Oops.Oh("\u5f02\u5e38\u6d88\u606f\uff1a{0}", "\u51fa\u9519\u4e86");\n')),(0,a.kt)("h2",{id:"42-\u6307\u5b9a\u7c7b\u578b\u7684\u5f02\u5e38"},"4.2 \u6307\u5b9a\u7c7b\u578b\u7684\u5f02\u5e38"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cs"},'throw Oops.Oh("\u5f02\u5e38\u6d88\u606f", typeof(ArgumentNullException));\nthrow Oops.Oh("\u5f02\u5e38\u6d88\u606f\uff1a{0}", typeof(ArgumentNullException), "\u51fa\u9519\u4e86");\n')),(0,a.kt)("h2",{id:"43-\u72b6\u6001\u7801\u5f02\u5e38"},"4.3 \u72b6\u6001\u7801\u5f02\u5e38"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cs"},'throw Oops.Oh(1000);\nthrow Oops.Oh(1000, "\u51fa\u9519\u4e86");\n')),(0,a.kt)("h2",{id:"44-\u72b6\u6001\u7801\u5f02\u5e38"},"4.4 \u72b6\u6001\u7801\u5f02\u5e38"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cs"},'throw Oops.Oh(1000, typeof(ArgumentNullException));\nthrow Oops.Oh(1000, typeof(ArgumentNullException), "\u51fa\u9519\u4e86");\n')),(0,a.kt)("h2",{id:"45-\u5f02\u5e38\u65b9\u6cd5\u91cd\u8bd5"},"4.5 \u5f02\u5e38\u65b9\u6cd5\u91cd\u8bd5"),(0,a.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,a.kt)("div",{parentName:"div",className:"admonition-heading"},(0,a.kt)("h5",{parentName:"div"},(0,a.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,a.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,a.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u8c03\u6574\u8bf4\u660e")),(0,a.kt)("div",{parentName:"div",className:"admonition-content"},(0,a.kt)("p",{parentName:"div"},(0,a.kt)("inlineCode",{parentName:"p"},"v2.17.0+")," \u7248\u672c\u4e0b\u9762\u65b9\u6cd5\u8bf7\u4f7f\u7528 ",(0,a.kt)("inlineCode",{parentName:"p"},"Retry.Invoke()")," \u66ff\u4ee3\u3002"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cs"},"Oops.Retry(() => {\n    // Do.....\n}, 3, 1000);\n\n// \u5e26\u8fd4\u56de\u503c\nvar value = Oops.Retry<int>(() => {\n    // Do.....\n}, 3, 1000);\n\n// \u53ea\u6709\u7279\u5b9a\u5f02\u5e38\u624d\u76d1\u542c\nOops.Retry(() => {\n\n}, 3, 1000, typeof(ArgumentNullException));\n")),(0,a.kt)("h2",{id:"46-\u629b\u51fa\u4e1a\u52a1\u5f02\u5e38"},"4.6 \u629b\u51fa\u4e1a\u52a1\u5f02\u5e38"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-cs"},'throw Oops.Bah("\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef");\nthrow Oops.Bah(1000);\n')))}d.isMDXComponent=!0}}]);