File tree Expand file tree Collapse file tree
haskell-debugger-view/src/GHC/Debugger/View Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ module GHC.Debugger.View.Class
5151
5252import Data.Int
5353import Data.Word
54+ import Control.Exception
5455
5556-- | Custom handling of debug terms (e.g. in the variables pane, or when
5657-- inspecting a lazy variable)
@@ -180,6 +181,15 @@ instance DebugView (a, b) where
180181 [ (" fst" , VarFieldValue x)
181182 , (" snd" , VarFieldValue y) ]
182183
184+ instance DebugView SomeException where
185+ debugValue e = simpleValue (displayException e) True
186+ debugFields e@ (SomeException exc) =
187+ let ! ctx = someExceptionContext e
188+ in pure $ VarFields
189+ [ (" exception" , VarFieldValue exc)
190+ , (" context" , VarFieldValue ctx)
191+ ]
192+
183193-- | This instance will display up to the first 50 forced elements of a list.
184194instance {-# OVERLAPPABLE #-} DebugView [a ] where
185195 debugValue [] = simpleValue " []" False
@@ -219,4 +229,3 @@ toVarFieldsIO :: VarFields -> [(IO String, VarFieldValue)]
219229toVarFieldsIO x =
220230 case x of
221231 VarFields fls -> [ (pure fl_s, b) | (fl_s, b) <- fls]
222-
You can’t perform that action at this time.
0 commit comments