Estoy usando axios para hacer una solicitud http GET. En algunas situaciones, mi servidor devuelve más de un GB de datos y provoca un error. Para una solución a corto plazo, quiero detectar el error y registrarlo; sin embargo, me resulta difícil detectar el error. Usando un .catch mencionado aquí , y en la documentación de axios , todavía no puedo detectar el 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); });