question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can Transformer be less naive when using VisitError?

See original GitHub issue

The new VisitError is great, but it come with a problem. If I am raising an error inside a transformer function, VisitError catches it and formats it, so there’s no way to retrieve the original error.

Of course the problem in the first place is that there is a catch-all statement that does not leave any room for custom error handling. A simple handle_errors flag that could be passed to Transformer.transform and disable Transformer raising VisitError and letting the error go would work, but there are many ways to achieve this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
erezshcommented, Feb 1, 2019

Pushed a fix to master.

You can now do something like:

try:
    T().transform(tree)
except VisitError as e:
    raise e.orig_exc

Is that good enough, or do you still want an option to disable VisitError wrapping?

0reactions
chaositecommented, Jan 31, 2019

The exception object itself is not the only thing that is lost by wrapping the exception, you also lose the exception context, so pdb post-mortem is much less helpful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Merge branch 'lark-parser:master' into master · 31509ace09 ...
We show how, by using namespaces, Lark grammars and their transformers can be fully reused -. they don't need to care if their...
Read more >
The Essence Of Strategic Programming - An inquiry into trans ...
As we will see, this dilemma can be solved with strategic program- ... The naive-innermost and innermost combinators both implement the.
Read more >
THE ESSENCE OF STRATEGIC PROGRAMMING An inquiry ...
As we will see, this dilemma can be solved with strategic program- ... The naive-innermost and innermost combinators both implement the.
Read more >
Generic Traversal over Typed Source Code Representations
sued not purely as an end in itself, but with relevance to and inspiration from the ... But at least this behavior can...
Read more >
Réécriture et Modularité pour les Politiques de Sécurité
l'environnement des politiques et pour transformer le code non ... security requirements, that can even be stated using different languages.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found