Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

289
Views
Seeing error message from network tab, but not in the try/catch console.log(error)

I am working on the front-end part of a project, and the backend is done, basically when a condition is met, the backend will send 409 conflict and a specific error message, and my job is to capture that error message and let that to be displayed on the front-end.

But I couldn't get the error message in the try-catch block, and only seeing the error message in the Network tab of Chrome.

Here's my try-catch front end code

try{
            const response = await this.request({
                path: `/api/xxx/xxx/{xxx}/xx`.replace(`{${"xxx"}}`, xx(String(requestParameters.terminalId))),
                method: 'PUT',
                headers: headerParameters,
                query: queryParameters,
                body: UpdateTerminalDataPortRequestDtoToJSON(requestParameters.updateTerminalDataPortRequestDto),
            }, initOverrides);
        }
        catch(e){
            console.log("error message")
            console.error(e)
        }

and here is what the Network Tab enter image description here

and here is what the console log error look like: enter image description here

How can I get the same error message as the one showing in the Networks?

Thanks in advance....any comment would be appreciated

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solved it by accessing err.response through catch

.catch(function (err) {
    console.log(err.response)
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!