bugsnag-haskell 0.0.4.3 → 0.0.4.4
raw patch · 5 files changed
+33/−11 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Aeson.Ext: instance Data.Aeson.Types.ToJSON.ToJSON Data.ByteString.Internal.ByteString
Files
- CHANGELOG.md +6/−2
- bugsnag-haskell.cabal +1/−1
- package.yaml +1/−1
- src/Data/Aeson/Ext.hs +0/−5
- src/Network/Bugsnag/Request.hs +25/−2
CHANGELOG.md view
@@ -1,6 +1,10 @@-## [_Unreleased_](https://github.com/pbrisbin/bugsnag-haskell/compare/v0.0.4.3...main)+## [_Unreleased_](https://github.com/pbrisbin/bugsnag-haskell/compare/v0.0.4.4...main) -None.+- None++## [v0.0.4.4](https://github.com/pbrisbin/bugsnag-haskell/compare/v0.0.4.3...v0.0.4.4)++- Remove the orphan instance ToJSON ByteString ## [v0.0.4.3](https://github.com/pbrisbin/bugsnag-haskell/compare/v0.0.4.2...v0.0.4.3)
bugsnag-haskell.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: bugsnag-haskell-version: 0.0.4.3+version: 0.0.4.4 license: MIT license-file: LICENSE maintainer: pbrisbin@gmail.com
package.yaml view
@@ -1,5 +1,5 @@ name: bugsnag-haskell-version: 0.0.4.3+version: 0.0.4.4 synopsis: Bugsnag error reporter for Haskell description: Please see README.md homepage: https://github.com/pbrisbin/bugsnag-haskell#readme
src/Data/Aeson/Ext.hs view
@@ -13,11 +13,9 @@ import Prelude import Data.Aeson-import Data.ByteString (ByteString) import Data.Char (toLower) import Data.List (stripPrefix) import Data.Maybe (fromMaybe)-import Data.Text.Encoding (decodeUtf8) #if MIN_VERSION_aeson(2,0,0) import Data.Aeson.Key (fromText)@@ -26,9 +24,6 @@ fromText :: Text -> Text fromText = id #endif--instance ToJSON ByteString where- toJSON = String . decodeUtf8 -- | Our custom Aeson @'Options'@ --
src/Network/Bugsnag/Request.hs view
@@ -11,10 +11,13 @@ import Control.Applicative ((<|>)) import Data.Aeson import Data.Aeson.Ext+import Data.Aeson.Types import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as C8 import Data.IP import Data.Maybe (fromMaybe)+import Data.Text (Text)+import Data.Text.Encoding (decodeUtf8) import GHC.Generics import Network.Bugsnag.BugsnagRequestHeaders import Network.HTTP.Types@@ -32,8 +35,28 @@ deriving stock Generic instance ToJSON BugsnagRequest where- toJSON = genericToJSON $ bsAesonOptions "br"- toEncoding = genericToEncoding $ bsAesonOptions "br"+ toJSON BugsnagRequest {..} = object+ (("clientIp" .=? (decodeUtf8 <$> brClientIp))+ <> ("headers" .=? brHeaders)+ <> ("httpMethod" .=? (decodeUtf8 <$> brHttpMethod))+ <> ("url" .=? (decodeUtf8 <$> brUrl))+ <> ("referer" .=? (decodeUtf8 <$> brReferer))+ )+ where+ -- For implementing "omit Nothing fields"+ (.=?) :: ToJSON v => Text -> Maybe v -> [Pair]+ (.=?) k = maybe [] (pure . (fromText k .=))+ toEncoding BugsnagRequest {..} = pairs+ (("clientIp" .=? (decodeUtf8 <$> brClientIp))+ <> ("headers" .=? brHeaders)+ <> ("httpMethod" .=? (decodeUtf8 <$> brHttpMethod))+ <> ("url" .=? (decodeUtf8 <$> brUrl))+ <> ("referer" .=? (decodeUtf8 <$> brReferer))+ )+ where+ -- For implementing "omit Nothing fields"+ (.=?) :: ToJSON v => Text -> Maybe v -> Series+ k .=? mv = maybe mempty (\v -> fromText k .= v) mv -- | Constructs an empty @'BugsnagRequest'@ bugsnagRequest :: BugsnagRequest