Built motion from commit e0fa946e.|2.6.5
[motion2.git] / server / errors / api.js
index 1cefc13..6879f40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['Forbidden','OutOfInterval','status','exports','api','message','Internal\x20Server\x20Error','name','Bad\x20Request','inherits','Entity\x20not\x20found','Not\x20Found'];(function(_0x4b5c96,_0x4ec3d2){var _0x3599c8=function(_0x27d4f3){while(--_0x27d4f3){_0x4b5c96['push'](_0x4b5c96['shift']());}};_0x3599c8(++_0x4ec3d2);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x49c4('0x0'));var APIError=function(_0x18bf2d,_0x26844b){this[_0x49c4('0x1')]=_0x18bf2d||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x26844b||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x41a183){this['message']=_0x41a183||_0x49c4('0x4');this[_0x49c4('0x3')]=_0x49c4('0x4');util[_0x49c4('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x436234){this['message']=_0x436234||_0x49c4('0x6');this[_0x49c4('0x3')]=_0x49c4('0x7');util[_0x49c4('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x4c7d3a){switch(_0x4c7d3a){case'Bad\x20Request':return 0x190;case _0x49c4('0x8'),_0x49c4('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0xb611a1){return function(_0x459d09){logger['error'](_0x459d09['stack']);var _0x1d19bf=getStatusCode(_0x459d09[_0x49c4('0x3')]);if(_0x459d09['name'])delete _0x459d09[_0x49c4('0x3')];return _0xb611a1[_0x49c4('0xa')](_0x1d19bf)['send'](_0x459d09);};}module[_0x49c4('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
+var _0x153f=['inherits','Forbidden','OutOfInterval','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','Error','Bad\x20Request','name','Entity\x20not\x20found','Not\x20Found'];(function(_0x5d3723,_0x20056c){var _0x442df9=function(_0x32bb80){while(--_0x32bb80){_0x5d3723['push'](_0x5d3723['shift']());}};_0x442df9(++_0x20056c);}(_0x153f,0x15b));var _0xf153=function(_0x35d14,_0x49b9f4){_0x35d14=_0x35d14-0x0;var _0x4da3c7=_0x153f[_0x35d14];return _0x4da3c7;};'use strict';var util=require(_0xf153('0x0'));var logger=require(_0xf153('0x1'))(_0xf153('0x2'));var APIError=function(_0x44cea3,_0x2afb9a){this[_0xf153('0x3')]=_0x44cea3||_0xf153('0x4');this['name']=_0x2afb9a||_0xf153('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1f9ead){this[_0xf153('0x3')]=_0x1f9ead||_0xf153('0x6');this[_0xf153('0x7')]=_0xf153('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x17ba96){this[_0xf153('0x3')]=_0x17ba96||_0xf153('0x8');this[_0xf153('0x7')]=_0xf153('0x9');util[_0xf153('0xa')](APINotFoundError,APIError);};function getStatusCode(_0x44845c){switch(_0x44845c){case _0xf153('0x6'):return 0x190;case _0xf153('0xb'),_0xf153('0xc'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2b76eb){return function(_0x1c8de7){logger[_0xf153('0xd')](_0x1c8de7['stack']);var _0x3a8838=getStatusCode(_0x1c8de7[_0xf153('0x7')]);if(_0x1c8de7[_0xf153('0x7')])delete _0x1c8de7[_0xf153('0x7')];return _0x2b76eb[_0xf153('0xe')](_0x3a8838)[_0xf153('0xf')](_0x1c8de7);};}module[_0xf153('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file