From c7f725a9e0fa625eb57e84f92b83007359ea6468 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 22 Oct 2014 16:29:10 +0400 Subject: [PATCH] Improved API error debug info --- app/js/lib/mtproto.js | 2 +- app/js/lib/mtproto_wrapper.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index c3d49ddc..880e32f3 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -204,7 +204,7 @@ angular.module('izhukov.mtproto', ['izhukov.utils']) transformRequest: null }); } catch (e) { - requestPromise = $q.reject(e); + requestPromise = $q.reject({code: 406, type: 'NETWORK_BAD_RESPONSE', originalError: e}); } return requestPromise.then( function (result) { diff --git a/app/js/lib/mtproto_wrapper.js b/app/js/lib/mtproto_wrapper.js index ac5cf2a7..2315b8dd 100644 --- a/app/js/lib/mtproto_wrapper.js +++ b/app/js/lib/mtproto_wrapper.js @@ -108,7 +108,7 @@ angular.module('izhukov.mtproto.wrapper', ['izhukov.utils', 'izhukov.mtproto']) if (!options.noErrorBox) { error.input = method; - error.stack = error.stack || (new Error()).stack; + error.stack = error.originalError && error.originalError.stack || error.stack || (new Error()).stack; setTimeout(function () { if (!error.handled) { ErrorService.show({error: error});