Built motion from commit 2e4747fd.|2.6.7
[motion2.git] / server / errors / api.js
index 08760d1..31a6982 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x750a=['Error','inherits','Bad\x20Request','Forbidden','OutOfInterval','stack','status','exports','../config/logger','message','Internal\x20Server\x20Error','name'];(function(_0x11ffaa,_0x1578d2){var _0x4a7989=function(_0x3d4075){while(--_0x3d4075){_0x11ffaa['push'](_0x11ffaa['shift']());}};_0x4a7989(++_0x1578d2);}(_0x750a,0x140));var _0xa750=function(_0x41c19d,_0x3674f6){_0x41c19d=_0x41c19d-0x0;var _0x4f1f15=_0x750a[_0x41c19d];return _0x4f1f15;};'use strict';var util=require('util');var logger=require(_0xa750('0x0'))('api');var APIError=function(_0x499583,_0x139fa5){this[_0xa750('0x1')]=_0x499583||_0xa750('0x2');this[_0xa750('0x3')]=_0x139fa5||_0xa750('0x4');util[_0xa750('0x5')](APIError,Error);};var APIBadRequestError=function(_0x562911){this[_0xa750('0x1')]=_0x562911||_0xa750('0x6');this[_0xa750('0x3')]=_0xa750('0x6');util[_0xa750('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3d7c43){this['message']=_0x3d7c43||'Entity\x20not\x20found';this[_0xa750('0x3')]='Not\x20Found';util[_0xa750('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x1760f5){switch(_0x1760f5){case'Bad\x20Request':return 0x190;case _0xa750('0x7'),_0xa750('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x5aca9c){return function(_0xcb62ae){logger['error'](_0xcb62ae[_0xa750('0x9')]);var _0x5adaae=getStatusCode(_0xcb62ae['name']);if(_0xcb62ae[_0xa750('0x3')])delete _0xcb62ae[_0xa750('0x3')];return _0x5aca9c[_0xa750('0xa')](_0x5adaae)['send'](_0xcb62ae);};}module[_0xa750('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
+var _0x878f=['Bad\x20Request','Forbidden','Not\x20Found','error','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x878f,0x173));var _0xf878=function(_0x2817fc,_0x215d5f){_0x2817fc=_0x2817fc-0x0;var _0x37c46e=_0x878f[_0x2817fc];return _0x37c46e;};'use strict';var util=require('util');var logger=require(_0xf878('0x0'))(_0xf878('0x1'));var APIError=function(_0x2e1d23,_0x12df2b){this[_0xf878('0x2')]=_0x2e1d23||_0xf878('0x3');this[_0xf878('0x4')]=_0x12df2b||_0xf878('0x5');util[_0xf878('0x6')](APIError,Error);};var APIBadRequestError=function(_0xcf1927){this[_0xf878('0x2')]=_0xcf1927||'Bad\x20Request';this['name']=_0xf878('0x7');util[_0xf878('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x59e564){this['message']=_0x59e564||'Entity\x20not\x20found';this[_0xf878('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x307653){switch(_0x307653){case _0xf878('0x7'):return 0x190;case _0xf878('0x8'),'OutOfInterval':return 0x193;case _0xf878('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x1399a3){return function(_0x531b9c){logger[_0xf878('0xa')](_0x531b9c['stack']);var _0x31d3d2=getStatusCode(_0x531b9c[_0xf878('0x4')]);if(_0x531b9c[_0xf878('0x4')])delete _0x531b9c['name'];return _0x1399a3[_0xf878('0xb')](_0x31d3d2)[_0xf878('0xc')](_0x531b9c);};}module[_0xf878('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file