pbrisbin / bugsnag-haskell

Bugsnag error reporter for Haskell
10 stars 7 forks source link

Exception splice should be before arguments #2

Closed pbrisbin closed 6 years ago

pbrisbin commented 6 years ago

Currently:

bugsnagException accepts arguments and splices BugsnagException.

throwIO $(bugsnagException "myFunc" "Error message")

Proposed:

bugsnagException accepts no arguments and splices Text -> Text -> BugsnagException

throwIO $(bugsnagException) "myFunc" "Error message"

-- Not sure yet if it needs to be this, which would be sad
throwIO $ $(bugsnagException) "myFunc" "Error message"

-- We could provide this, if so
$(throwBugsnag) "myFunc" "Error message"

Benefits:

You aren't blocked by stage-restriction from doing something like

throwIO $(bugsnagException) "myFunc" $ "User not found " <> userId

Which is not possible with the current splice type.