Built motion from commit eddce310.|2.6.12
[motion2.git] / server / errors / api.js
index 995e45b..719d319 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4e6=['OutOfInterval','error','status','send','exports','util','api','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','Not\x20Found','inherits','Forbidden'];(function(_0x2df748,_0x3812cc){var _0x32bc6c=function(_0x52a547){while(--_0x52a547){_0x2df748['push'](_0x2df748['shift']());}};_0x32bc6c(++_0x3812cc);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xb4e6[_0x2f71f6];return _0x2b23ea;};'use strict';var util=require(_0x6b4e('0x0'));var logger=require('../config/logger')(_0x6b4e('0x1'));var APIError=function(_0x1afd20,_0x365912){this[_0x6b4e('0x2')]=_0x1afd20||_0x6b4e('0x3');this[_0x6b4e('0x4')]=_0x365912||_0x6b4e('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x40da90){this[_0x6b4e('0x2')]=_0x40da90||_0x6b4e('0x6');this['name']=_0x6b4e('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x4f00be){this[_0x6b4e('0x2')]=_0x4f00be||'Entity\x20not\x20found';this['name']=_0x6b4e('0x7');util[_0x6b4e('0x8')](APINotFoundError,APIError);};function getStatusCode(_0x1e3bf6){switch(_0x1e3bf6){case _0x6b4e('0x6'):return 0x190;case _0x6b4e('0x9'),_0x6b4e('0xa'):return 0x193;case _0x6b4e('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x49c734){return function(_0x39b4ec){logger[_0x6b4e('0xb')](_0x39b4ec['stack']);var _0x2a4d0f=getStatusCode(_0x39b4ec[_0x6b4e('0x4')]);if(_0x39b4ec[_0x6b4e('0x4')])delete _0x39b4ec[_0x6b4e('0x4')];return _0x49c734[_0x6b4e('0xc')](_0x2a4d0f)[_0x6b4e('0xd')](_0x39b4ec);};}module[_0x6b4e('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
+var _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x309695,_0x2f9b04){var _0x63b74c=function(_0xcb2995){while(--_0xcb2995){_0x309695['push'](_0x309695['shift']());}};_0x63b74c(++_0x2f9b04);}(_0x91a7,0xe7));var _0x791a=function(_0x3917a8,_0xa82e69){_0x3917a8=_0x3917a8-0x0;var _0x3f14ae=_0x91a7[_0x3917a8];return _0x3f14ae;};'use strict';var util=require('util');var logger=require(_0x791a('0x0'))(_0x791a('0x1'));var APIError=function(_0x268862,_0x5d2796){this[_0x791a('0x2')]=_0x268862||'Internal\x20Server\x20Error';this[_0x791a('0x3')]=_0x5d2796||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x32fe2b){this[_0x791a('0x2')]=_0x32fe2b||'Bad\x20Request';this[_0x791a('0x3')]='Bad\x20Request';util[_0x791a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x159e24){this['message']=_0x159e24||_0x791a('0x5');this[_0x791a('0x3')]=_0x791a('0x6');util[_0x791a('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x266e4b){switch(_0x266e4b){case'Bad\x20Request':return 0x190;case _0x791a('0x7'),_0x791a('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2bd26a){return function(_0x206eea){logger[_0x791a('0x9')](_0x206eea[_0x791a('0xa')]);var _0x2805c9=getStatusCode(_0x206eea[_0x791a('0x3')]);if(_0x206eea['name'])delete _0x206eea['name'];return _0x2bd26a[_0x791a('0xb')](_0x2805c9)[_0x791a('0xc')](_0x206eea);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file