amnh / PCG

𝙋𝙝𝙮𝙡𝙤𝙜𝙚𝙣𝙚𝙩𝙞𝙘 𝘾𝙤𝙢𝙥𝙤𝙣𝙚𝙣𝙩 𝙂𝙧𝙖𝙥𝙝 ⸺ Haskell program and libraries for general phylogenetic graph search
28 stars 1 forks source link

Replace error with panic for improved debugging #147

Closed recursion-ninja closed 3 years ago

recursion-ninja commented 5 years ago

We currently call error in a number of places where "impossible" conditions occur or unimplemented features exist on a codepath. The function error will not supply a stack-trace (unless built with profiling, usually). The function panic will provide a stack-trace and additional contextual information.

Since rebuilding with profiling is time intensive, we should replace all occurrences of error with panic to ease our development experience.

recursion-ninja commented 3 years ago

Replacing error with panic does not provide stack traces by default. Best to stick with error.

Using panic gives us this unhelpful and misleading error message:

user@box:~/$ pcg < input.pcg
pcg: pcg: panic! (the 'impossible' happened)
  (GHC version 8.10.2:
    Impossible happened in 'deriveImpliedAlignment'

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug