Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

287
Vistas
How to handle API request that does not throw catch? (403 error)

Tried to access blob storage API with the following method but getting 403 return without error throw(this happen because I'm trying to access file that does not exist/no permission). How should such error be handled? .catch is already applied while calling the API.

Background.. I'm trying to make mistake by purpose to get a file inside Azure blob storage. I do expect 403 and I wish to handle this properly.

Get method

 getReq = async url => {
    return new Promise((resolve, reject) => {
      axios
        .get(url)
        .then(function (response) {
          resolve(response.data);
        })
        .catch(function (error) {
          reject(error);
        })
    });
  };

Response received from postman

<?xml version="1.0" encoding="utf-8"?>
<Error>
    <Code>AuthenticationFailed</Code>
    <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:maskedInfo
Time:maskedInfo</Message>
    <AuthenticationErrorDetail>Signature did not match. String to sign used was 


/blob/maskedInfo/maskedInfo/maskedInfo.json
ReadOnly


2020-08-04
b





</AuthenticationErrorDetail>
</Error>

Tried:

  1. TryCatch does not catch the issue either

Error show from React Native: enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When you call getReq() method, It will return a Promise. So, You should handle the rejection.

getReq("https://somerandomurl.com")
  .then(res => {
    console.log(res);
  })
  .catch(err => {
    console.error(err);
  })

In await style,

try {
  const res = await getReq("https://somerandomurl.com");
} catch (err) {
  console.error(err);
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda