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

113
Vistas
Is it possible to create Try Catch block which will run every single function?

So, my question is generally about some debugging and troubleshooting for people who don't really understand programming at all. Is it possible to create a method like:

public foo(method){
try(){
method();
}
catch(error){
console.log(method().name + 'caused an error'); 
throw Error;
}

is it generally okay to do something like that, yes, I know that errors are shown very good even without something similar but if, for example I'm doing testing for a client who wants to know about everything and see what's exactly goes wrong. I'd like to let him know about problems as much as I can, I already have allure reporter on my project but it is not enough

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

0

Probably it is. But there are so many good ways to use logger to use allure report with step description for every single method that you run.

So people will see every action which is called in human-readable form. They will have a stack trace with screenshot and video, it can't get better than that.

To use allure in playwright.config file use

reporter: [
    ["allure-playwright"],
    ["list"]
],

also, list

"allure-commandline": "^2.13.0",
"allure-playwright": "^2.0.0-beta.14",

in package.json

You can cal every method like this

await test.step('Exatc action in method described in human readable language e.g. Click Send Button', async () => {
    // ...your method
  });

Also, there is a test error built-in playwright, so you do not need to build your own. See section:

testStep.error
type: <TestError>

on: https://playwright.dev/docs/api/class-teststep#test-step-error

For opening allure use:

"open-allure": "allure generate ./target/allure-results -c ./allure-report && allure open",

And one more thing. Playwright has the best debug mode on market, it shows your code and every action in browser see: https://playwright.dev/docs/inspector

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