"use strict"; const axios = require("axios"); const Promise = require("bluebird"); const getJson = require("."); let manualAxios = axios.create(getJson.axiosConfiguration); Promise.try(() => { return manualAxios.get("http://cryto.net/invalid.json"); // {"hello": "world" }).then((response) => { let parsedJson = getJson.parse(response); /* throws: ParsingFailed: Could not parse response body as JSON */ console.log(parsedJson); });