diff --git a/lib/apicontrollersbase.js b/lib/apicontrollersbase.js index 613b51a..0f1f702 100644 --- a/lib/apicontrollersbase.js +++ b/lib/apicontrollersbase.js @@ -89,7 +89,11 @@ class APIOperationBase { var obj = this; - logger.debug(JSON.stringify(this._request, 2, null)); + try { + logger.debug(JSON.stringify(this._request, null, 2)); + } catch (e) { + logger.debug('Could not stringify request:', e.message); + } var axiosConfig = { baseURL: this._endpoint, @@ -107,7 +111,7 @@ class APIOperationBase { axios.request(axiosConfig).then((response) => { if (typeof response.data !== 'undefined') { var responseObj = JSON.parse(JSON.stringify(response.data)); - logger.debug(JSON.stringify(responseObj, 2, null)); + logger.debug(JSON.stringify(responseObj, null, 2)); obj._response = responseObj; callback(); } else {