Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors no longer reported in stdout scotty-0.20.1 #404

Open
chrissound opened this issue Aug 18, 2024 · 5 comments
Open

Errors no longer reported in stdout scotty-0.20.1 #404

chrissound opened this issue Aug 18, 2024 · 5 comments
Labels
info needed More information is needed test needed

Comments

@chrissound
Copy link

chrissound commented Aug 18, 2024

{-# LANGUAGE OverloadedStrings #-}  
module Main where

import Web.Scotty

main :: IO ()
main = do
  scotty 3000 $ do
    get "/test" $ do
      error "test"

Previously in scotty-0.12.1 this would have printed something like:

CallStack (from HasCallStack):
  error, called at src/Main.hs:16:7 in main:Main

But now there is literally no output

@ocramz
Copy link
Collaborator

ocramz commented Aug 18, 2024

Hm, I don't think there's a way to disable error from crashing the app, are you sure you're hitting the right endpoint?

@chrissound
Copy link
Author

chrissound commented Aug 18, 2024

Yup 99% sure. This unexpected behavior does not to happen on the latest release (scotty 0.22 from hackage), so it's fixed there but broken likely for some versions prior.

If you're familiar with nix I have a full minimal example here:
https://github.com/chrissound/scotty-error-issue

It seems 0.20 and 0.21 is affected as well. One good thing is it's fixed now already, actually I'm not sure if this github issue should remain open in that case. At least it's documented.

@ocramz
Copy link
Collaborator

ocramz commented Aug 21, 2024

so, we did in fact overhaul exceptions handling in recent versions but I don't see how error would be affected.

@chrissound
Copy link
Author

Are you perhaps able to replicate? I tried creating a failing test case for this, but didn't have much luck. I also tried creating a github action a moment ago but for some reason the whole body response isn't even appearing https://github.com/chrissound/scotty-error-issue/actions/runs/10497035641/job/29078973137 :/

@chrissound
Copy link
Author

I think it was output buffering being an issue on my previous github action. None the less I'm able to replicate this finally on: https://github.com/chrissound/scotty-error-issue/actions/runs/10507995937/job/29110936575#step:4:808

I wonder if it's perhaps an issue related to output buffering in the first place though? In any case adding

hSetBuffering stdin NoBuffering
hSetBuffering stdout NoBuffering

Does not fix it locally or on github actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info needed More information is needed test needed
Projects
None yet
Development

No branches or pull requests

2 participants