I'm using axios to make an http GET request. In some situations my server is returning more than a GB of data causing an error. For a short term solution I want to catch the error and log it however I'm finding it difficult to catch the error. Using a .catch mentioned here, and in the axios documentation, I'm still unable to catch the error.
buffer.js:776
return this.utf8Slice(start, end);
^
Error: Cannot create a string longer than 0x3fffffe7 characters
// without a catch
const res = await axios.get<string, AxiosResponse<Record<string, any>>>("http://foo.bar/huge_string_response");
// with a catch, still throws
const res = await axios
.get<string, AxiosResponse<Record<string, any>>>("http://foo.bar/huge_string_response")
.catch((err) => {console.log("error: " + err); });