haskell / haskell/aeson

throwDecode doesn't have HasCallStack

Open Beginner friendly
#1,187 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.3k
Forks
336
Avg merge
3d 7h
Merged PRs (30d)
4

Description

though `throwM` does.

So the backtraces collected by exceptions end somewhere inside `aeson` library, not including the call-site of `throwDecode`:

```
*Data.Aeson> :m +Control.Exception
*Data.Aeson Control.Exception> :set -XOverloadedStrings
*Data.Aeson Control.Exception> throwIO (AesonException "wrong")
*** Exception: aeson: wrong

HasCallStack backtrace:
throwIO, called at :3:1 in interactive:Ghci1

*Data.Aeson Control.Exception> throwDecode "nll" :: IO Int
*** Exception: aeson: Unexpected "nll", expecting JSON value

HasCallStack backtrace:
throwIO, called at libraries/exceptions/src/Control/Monad/Catch.hs:343:12 in exceptions-0.10.11-97e4:Control.Monad.Catch
throwM, called at src/Data/Aeson/Decoding.hs:89:61 in aeson-2.3.1.0-inplace:Data.Aeson.Decoding

```

Contributor guide

Open the contributing guide

Research direction

Start with the throwDecode entry point in src/Data/Aeson/Decoding.hs around line 89, and compare its exception handling with throwM. Reproduce the shown throwDecode example, then verify that the resulting HasCallStack backtrace includes the caller rather than ending inside aeson.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.