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

159
Views
¿Hay alguna manera de stub/interceptar una declaración de javascript 'lanzar' en javascript de vainilla?

Podemos agregar cualquier función o clase como esta,

 class ErrorStub{ constructor(message){ // do whatever with 'message' } } Error = ErrorStub new Error('This will go to ErrorStub now')

Similar a esto, ¿hay alguna forma en que podamos interceptar una declaración de 'lanzar'? ¿Para que cualquier excepción que se produzca en todo el sitio web se pueda manejar en un solo lugar?

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

0

¿No satisfaría esto sus necesidades? Debería escuchar el evento de error , manejarlo de la manera que desee y return false

 function interceptError(exception) { // Here you can write code which intercepts before // the error gets triggered and printed in the console alert(`Exception occured: ${exception.message}`) } window.addEventListener("error", function (e) { interceptError(e); return false; }) throw new Error('Test exception');

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!