packages feed

bugsnag-types-1.1.0.1: src/Data/Bugsnag/Types/SeverityReasonType.hs

module Data.Bugsnag.Types.SeverityReasonType
  ( SeverityReasonType (..)
  , exampleSeverityReasonType
  ) where

import Data.Bugsnag.Types.Prelude

-- | A type key that represents the reason for the assigned severity.
--
-- -   @unhandledException@- Whenever an uncaught exception is discovered
--     (generic).
-- -   @unhandledError@ - When an error is discovered (PHP).
-- -   @log@ - Whenever a log message is sent (generic).
-- -   @signal@ - Whenever a \"fatal\" signal is discovered (iOS).
-- -   @strictMode@ - Whenever a strictMode issue is discovered (Android).
-- -   @unhandledPromiseRejection@ Whenever an unhandled promise rejection
--     is discovered (JS\/Node JS\/React Native).
-- -   @callbackErrorIntercept@- callbackErrorIntercept (Node JS).
-- -   @errorClass@ - Whenever an exception with a particular class is
--     automatically sent (Ruby).
-- -   @exceptionClass@ - Whenever an exception with a particular class is
--     automatically sent (Java).
-- -   @unhandledPanic@ - When a panic is unhandled and crashes the app
--     (Go).
-- -   @unhandledErrorMiddleware@ - Unhandled errors in ${Negroni}
--     middleware have a default severity:error.
-- -   @unhandledExceptionMiddleware@ - Unhandled exceptions in ${Rack}
--     middleware have a default severity:error.
-- -   @userCallbackSetSeverity@ - Whenever a callback changes a report\'s
--     severity (generic).
-- -   @userSpecifiedSeverity@ - Whenever a severity is set through a
--     manual notify call (generic).
-- -   @handledException@ - Whenever a handled exception is sent through
--     (generic).
-- -   @handledError@ - Whenever a handled error is sent through (PHP).
-- -   @handledPanic@ - Whenever a panic is handled through AutoNotify or
--     Recover (Go).
-- -   @userContextSetSeverity@ - When a user creates a context which
--     changes the severity (Python).
-- -   @anrError@ - Whenever an ANR is detected (Android).
-- -   @appHang@ - Whenever an app hang is detected (Cocoa).
-- -   @outOfMemory@ - When an app is terminated because it used too much
--     memory (Cocoa).
-- -   @thermalKill@ - When an app is terminated because the device is
--     overheating (Cocoa).
data SeverityReasonType
  = UnhandledException
  | UnhandledError
  | Log
  | Signal
  | StrictMode
  | UnhandledPromiseRejection
  | CallbackErrorIntercept
  | ErrorClass
  | ExceptionClass
  | UnhandledPanic
  | UnhandledErrorMiddleware
  | UnhandledExceptionMiddleware
  | UserCallbackSetSeverity
  | UserSpecifiedSeverity
  | HandledException
  | HandledError
  | HandledPanic
  | UserContextSetSeverity
  | AnrError
  | AppHang
  | OutOfMemory
  | ThermalKill
  deriving stock (Bounded, Enum, Eq, Show, Generic)

instance FromJSON SeverityReasonType where
  parseJSON = genericParseJSON aesonOptions

instance ToJSON SeverityReasonType where
  toJSON = genericToJSON aesonOptions
  toEncoding = genericToEncoding aesonOptions

exampleSeverityReasonType :: SeverityReasonType
exampleSeverityReasonType = UnhandledException