Built motion from commit 20b39a97.|2.6.29
[motion2.git] / server / errors / api.js
index 16af219..8d951d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x82ec=['OutOfInterval','Resource\x20Conflict','Not\x20Found','Conflict','error','statusMessage','status','send','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x82ec,0x110));var _0xc82e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x82ec[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0xc82e('0x0'));var logger=require(_0xc82e('0x1'))(_0xc82e('0x2'));var APIError=function(_0x5c7bc8,_0x1759e6){this[_0xc82e('0x3')]=_0x5c7bc8||'Internal\x20Server\x20Error';this[_0xc82e('0x4')]=_0x1759e6||_0xc82e('0x5');util[_0xc82e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x1b722c){this[_0xc82e('0x3')]=_0x1b722c||_0xc82e('0x7');this[_0xc82e('0x4')]=_0xc82e('0x7');util[_0xc82e('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x2b882f){this[_0xc82e('0x3')]=_0x2b882f||'Forbidden';this[_0xc82e('0x4')]=_0xc82e('0x8');util[_0xc82e('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0xeeb08){this[_0xc82e('0x3')]=_0xeeb08||_0xc82e('0x9');this['name']='Not\x20Found';util[_0xc82e('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2734a1){this[_0xc82e('0x3')]=_0x2734a1||_0xc82e('0xa');this[_0xc82e('0x4')]=_0xc82e('0xb');this[_0xc82e('0xc')]=0x193;this[_0xc82e('0xd')]={'type':_0xc82e('0xe')};util[_0xc82e('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x563eac){this[_0xc82e('0x3')]=_0x563eac||_0xc82e('0xf');this['name']='Conflict';util[_0xc82e('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x4c01b5){switch(_0x4c01b5){case'Bad\x20Request':return 0x190;case _0xc82e('0x8'),_0xc82e('0xb'):return 0x193;case _0xc82e('0x10'):return 0x194;case _0xc82e('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x38a340){if(_0x38a340===_0xc82e('0xb'))return _0x38a340;return null;}function handleError(_0x97f3f9){return function(_0x3893c7){logger[_0xc82e('0x12')](_0x3893c7['stack']);var _0x44cfd9=getStatusCode(_0x3893c7['name']);var _0x9260a0=getCustomStatusMessage(_0x3893c7[_0xc82e('0x4')]);if(_0x3893c7[_0xc82e('0x4')]){delete _0x3893c7[_0xc82e('0x4')];}if(_0x9260a0){_0x97f3f9[_0xc82e('0x13')]=_0x9260a0;}return _0x97f3f9[_0xc82e('0x14')](_0x44cfd9)[_0xc82e('0x15')](_0x3893c7);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError};
\ No newline at end of file
+var _0xc5cb=['send','util','../config/logger','api','message','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','details','OutOfInterval','Resource\x20Conflict','Out\x20Of\x20Interval','Conflict','error','statusMessage','status'];(function(_0x3d8588,_0x4e514f){var _0x386d48=function(_0x2190cf){while(--_0x2190cf){_0x3d8588['push'](_0x3d8588['shift']());}};_0x386d48(++_0x4e514f);}(_0xc5cb,0x79));var _0xbc5c=function(_0x710dba,_0x32f351){_0x710dba=_0x710dba-0x0;var _0x4676bf=_0xc5cb[_0x710dba];return _0x4676bf;};'use strict';var util=require(_0xbc5c('0x0'));var logger=require(_0xbc5c('0x1'))(_0xbc5c('0x2'));var APIError=function(_0x3c22b4,_0x591923){this[_0xbc5c('0x3')]=_0x3c22b4||'Internal\x20Server\x20Error';this[_0xbc5c('0x4')]=_0x591923||'Error';util[_0xbc5c('0x5')](APIError,Error);};var APIBadRequestError=function(_0x213896){this[_0xbc5c('0x3')]=_0x213896||'Bad\x20Request';this[_0xbc5c('0x4')]=_0xbc5c('0x6');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5ca480){this['message']=_0x5ca480||'Forbidden';this[_0xbc5c('0x4')]=_0xbc5c('0x7');util[_0xbc5c('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x488b7e){this[_0xbc5c('0x3')]=_0x488b7e||_0xbc5c('0x8');this[_0xbc5c('0x4')]=_0xbc5c('0x9');util[_0xbc5c('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x19e2a8){this['message']=_0x19e2a8||_0xbc5c('0xa');this[_0xbc5c('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this[_0xbc5c('0xb')]={'type':_0xbc5c('0xc')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1fbb81){this[_0xbc5c('0x3')]=_0x1fbb81||_0xbc5c('0xd');this[_0xbc5c('0x4')]='Conflict';util[_0xbc5c('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x28be25){switch(_0x28be25){case _0xbc5c('0x6'):return 0x190;case'Forbidden',_0xbc5c('0xe'):return 0x193;case _0xbc5c('0x9'):return 0x194;case _0xbc5c('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x5cb9f5){if(_0x5cb9f5===_0xbc5c('0xe'))return _0x5cb9f5;return null;}function handleError(_0x2e92bf){return function(_0x27e744){logger[_0xbc5c('0x10')](_0x27e744['stack']);var _0x997f0a=getStatusCode(_0x27e744[_0xbc5c('0x4')]);var _0x169c2c=getCustomStatusMessage(_0x27e744['name']);if(_0x27e744[_0xbc5c('0x4')]){delete _0x27e744[_0xbc5c('0x4')];}if(_0x169c2c){_0x2e92bf[_0xbc5c('0x11')]=_0x169c2c;}return _0x2e92bf[_0xbc5c('0x12')](_0x997f0a)[_0xbc5c('0x13')](_0x27e744);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError};
\ No newline at end of file