-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path810aec93.f586fdbf.js
1 lines (1 loc) · 5.28 KB
/
810aec93.f586fdbf.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[22],{112:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return g}));var r=t(0),i=t.n(r);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?c(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=i.a.createContext({}),u=function(e){var n=i.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},s=function(e){var n=u(e.components);return i.a.createElement(p.Provider,{value:n},e.children)},b={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},d=i.a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),s=u(t),d=r,g=s["".concat(c,".").concat(d)]||s[d]||b[d]||o;return t?i.a.createElement(g,a(a({ref:n},p),{},{components:t})):i.a.createElement(g,a({ref:n},p))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,c=new Array(o);c[0]=d;var a={};for(var l in n)hasOwnProperty.call(n,l)&&(a[l]=n[l]);a.originalType=e,a.mdxType="string"==typeof e?e:r,c[1]=a;for(var p=2;p<o;p++)c[p]=t[p];return i.a.createElement.apply(null,c)}return i.a.createElement.apply(null,t)}d.displayName="MDXCreateElement"},90:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return c})),t.d(n,"metadata",(function(){return a})),t.d(n,"rightToc",(function(){return l})),t.d(n,"default",(function(){return u}));var r=t(3),i=t(7),o=(t(0),t(112)),c={id:"exception",title:"\u5f02\u5e38\u5904\u7406",sidebar_label:"\u5f02\u5e38\u5904\u7406"},a={unversionedId:"guide/exception",id:"guide/exception",isDocsHomePage:!1,title:"\u5f02\u5e38\u5904\u7406",description:"\u5efa\u8bae\u7edf\u4e00\u4f7f\u7528lightning\u7684BusinessException\uff0c\u5df2\u88ab\u8f83\u597d\u7684\u5c01\u88c5\u6709\u505a\u4e86\u6355\u6349\u5904\u7406\uff0c\u524d\u7aef\u754c\u9762\u7684\u63d0\u793a\u4e5f\u8f83\u4e3a\u5b8c\u5584\u3002",source:"@site/docs/guide/exception.md",slug:"/guide/exception",permalink:"/lightning-doc/docs/guide/exception",editUrl:"https://gitee.com/gitmen/lightning-doc-src/blob/master/docs/guide/exception.md",version:"current",sidebar_label:"\u5f02\u5e38\u5904\u7406",sidebar:"someSidebar",previous:{title:"\u4fe1\u53f7",permalink:"/lightning-doc/docs/guide/signal"},next:{title:"\u6570\u636e\u6743\u9650\u63a7\u5236",permalink:"/lightning-doc/docs/guide/shield"}},l=[{value:"\u76f4\u63a5\u4f7f\u7528",id:"\u76f4\u63a5\u4f7f\u7528",children:[]},{value:"\u7ee7\u627f",id:"\u7ee7\u627f",children:[]}],p={rightToc:l};function u(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(o.b)("wrapper",Object(r.a)({},p,t,{components:n,mdxType:"MDXLayout"}),Object(o.b)("p",null,"\u5efa\u8bae\u7edf\u4e00\u4f7f\u7528lightning\u7684BusinessException\uff0c\u5df2\u88ab\u8f83\u597d\u7684\u5c01\u88c5\u6709\u505a\u4e86\u6355\u6349\u5904\u7406\uff0c\u524d\u7aef\u754c\u9762\u7684\u63d0\u793a\u4e5f\u8f83\u4e3a\u5b8c\u5584\u3002"),Object(o.b)("p",null,"\u4f7f\u7528\u65b9\u5f0f\uff1a"),Object(o.b)("h3",{id:"\u76f4\u63a5\u4f7f\u7528"},"\u76f4\u63a5\u4f7f\u7528"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-python"}),"from lightning.exceptions import BusinessException\n\nraise BusinessException('90001', '\u975e\u6cd5\u64cd\u4f5c')\n")),Object(o.b)("h3",{id:"\u7ee7\u627f"},"\u7ee7\u627f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-python"}),"from lightning.exceptions import BusinessException\n\nclass MyException(BusinessException):\n def __init__(self, arg):\n super.__init__('90001', '\u975e\u6cd5\u64cd\u4f5c')\n self.arg = arg\n\nraise MyException('Got you')\n")),Object(o.b)("p",null,"BusinessException \u6784\u9020\u53c2\u6570\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"error_code: \u9519\u8bef\u4ee3\u7801\uff0c\u53ef\u81ea\u5b9a\u4e49\uff0c\u5b57\u7b26\u4e32\u7c7b\u578b\u3002"),Object(o.b)("li",{parentName:"ul"},"error_message\uff1a\u9519\u8bef\u4fe1\u606f\u3002\u5b57\u7b26\u4e32\u7c7b\u578b\u3002"),Object(o.b)("li",{parentName:"ul"},"error_data\uff1a\u9519\u8bef\u6570\u636e\uff0c\u4efb\u4f55\u53ef\u5e8f\u5217\u5316\u7684\u5bf9\u8c61\u3002"),Object(o.b)("li",{parentName:"ul"},"error_app\uff1a\u9519\u8bef\u7684 app_label\uff0c\u8981\u6c42\u5b57\u7b26\u4e32\u7c7b\u578b\u3002")))}u.isMDXComponent=!0}}]);