pbrisbin / bugsnag-haskell

Bugsnag error reporter for Haskell
10 stars 7 forks source link

StackFrame Code Support #14

Closed pbrisbin closed 6 years ago

pbrisbin commented 6 years ago

Here's a probably-terrible idea...

We could supply a TH function that reads your project directory into an index at compile time, which you then set on settings:

, bsCodeIndex = $(whateverDoTheThing "./src")

We could then have a function like BugsnagStackFrame -> BugsnagCodeIndex -> Maybe BugsnagCode which grabs the 6 lines of source by line number, which we'd then attach to the stack frame.

jezen commented 6 years ago

Why would this be terrible?

pbrisbin commented 6 years ago

I have no idea, just seems a little unusual, doesn't it? Feels like something that'll have security or performance problems.

jezen commented 6 years ago

I could envision security problems if both of the following are true:

  1. Stack traces are leaked to user
  2. Secrets are stored in code

Aside from that, I can't say. In any case, this experimental project may be useful, I'm not sure: https://hackage.haskell.org/package/error-context

pbrisbin commented 6 years ago

I'm now thinking this isn't too terrible an idea. It'll be fun to build, an isolated thing within the library, and 100% opt-in anyway. :+1:

pbrisbin commented 6 years ago

Merged. Will be in v0.0.2.0.