Safe Haskell | None |
---|---|
Language | Haskell2010 |
Network.Yeller.Internals
- data ErrorNotification a = ErrorNotification {}
- data StackFrame = StackFrame {}
- data StackOptions = StackOptions {}
- data ExtraErrorInfo a = ExtraErrorInfo {
- errorURL :: Maybe Text
- errorCustomData :: Maybe (Map Text a)
- errorLocation :: Maybe Text
- errorUser :: Maybe UserInfo
- errorHTTPRequest :: Maybe HTTPRequest
- data UserInfo = UserInfo {}
- emptyExtraErrorInfo :: ExtraErrorInfo Int
- data HTTPRequest = HTTPRequest {}
- makeJSONCustomData :: ToJSON a => ExtraErrorInfo a -> Value
- maybeAddUser :: ExtraErrorInfo a -> Map Text Value -> Map Text Value
- maybeAddHTTPUserAgent :: ExtraErrorInfo a -> Map Text Value -> Map Text Value
- maybeOr :: Maybe a -> a -> a
- yellerVersion :: Text
- newtype Backend = Backend Text
- data YellerClient
- data YellerClientErrorHandler = YellerClientErrorHandler {
- handleAuthenticationErrors :: Response BodyReader -> IO ()
- handleIOErrors :: SomeException -> ErrorNotification Value -> IO ()
- data ApplicationEnvironment
- newtype ApplicationPackage = ApplicationPackage Text
- newtype YellerToken = YellerToken Text
- data YellerClientSettings = YellerClientSettings {}
- defaultClientSettings :: YellerClientSettings
- defaultErrorHandler :: YellerClientErrorHandler
- bogusClientToken :: Text
- defaultBackends :: [Text]
- class (Typeable a, Show a) => ToError a where
- toError :: a -> ErrorNotification b -> ErrorNotification b
- defaultToError :: (Typeable e, Show e) => e -> ErrorNotification b -> ErrorNotification b
- parseStackLine :: String -> StackFrame
- manageNoLocationFilename :: Text -> Text
- parseStackTrace :: [String] -> [StackFrame]
- markInApp :: Text -> StackFrame -> StackFrame
- filterInAppLines :: Text -> [StackFrame] -> [StackFrame]
- sendError :: (ToError e, ToJSON a) => YellerClient -> e -> ExtraErrorInfo a -> IO ()
- sendNotification :: ToJSON a => YellerClient -> ErrorNotification a -> IO ()
- sendNotificationWithRetry :: ToJSON a => Int -> YellerClient -> ErrorNotification a -> ByteString -> IO ()
- handleNonExceptionalSendRequest :: ToJSON a => Response BodyReader -> Int -> YellerClient -> ErrorNotification a -> ByteString -> IO ()
- encodeCustomDataAsJSON :: ToJSON a => ErrorNotification a -> ErrorNotification Value
- cycleBackends :: YellerClient -> IO Backend
- cycleBackends_ :: [Backend] -> [Backend]
- modifyTVar_ :: TVar a -> (a -> a) -> STM ()
- makeRequest :: YellerClient -> Backend -> ByteString -> IO Request
- client :: YellerClientSettings -> IO YellerClient
- shutdownClient :: YellerClient -> IO ()
Documentation
data ErrorNotification a Source
An error notification. This is what is sent to Yeller's servers
Constructors
ErrorNotification | |
Fields
|
Instances
Eq a => Eq (ErrorNotification a) | |
Show a => Show (ErrorNotification a) | |
ToJSON b => ToJSON (ErrorNotification b) |
data StackFrame Source
A line of the stacktrace
Constructors
StackFrame | |
Fields
|
Instances
data StackOptions Source
Options to be associated with each line in the stacktrace. Currently only supports if the line is in the application or not.
Constructors
StackOptions | |
Fields |
Instances
data ExtraErrorInfo a Source
Extra error information to be passed along with an error. All fields are optional.
Constructors
ExtraErrorInfo | |
Fields
|
Instances
Eq a => Eq (ExtraErrorInfo a) | |
Show a => Show (ExtraErrorInfo a) |
Lets you attach which user the error happened with which lets you count the total number of affected users
emptyExtraErrorInfo :: ExtraErrorInfo Int Source
Extra error info with all fields turned off.
Useful when getting started, but real apps should fill in as many fields as possible for better debugging context
data HTTPRequest Source
Lets you attach which http request was occurring when the error happened which lets you see the browser, if the request came from a spider and so on
Constructors
HTTPRequest | |
Fields
|
Instances
makeJSONCustomData :: ToJSON a => ExtraErrorInfo a -> Value Source
maybeAddUser :: ExtraErrorInfo a -> Map Text Value -> Map Text Value Source
maybeAddHTTPUserAgent :: ExtraErrorInfo a -> Map Text Value -> Map Text Value Source
An endpoint to send errors with. Must end with "/" sample:
Backend "https://collector1.yellerapp.com"
data YellerClient Source
A Yeller client.
Build one with client
like so:
client (defaultClientSettings { clientSettingsToken = YellerToken YOUR_TOKEN_HERE })
Used to keep persistent http connections alive, keep track of which endpoint to send to, and a bunch of data that's sent along with the error.
Constructors
YellerClient | |
Fields
| |
DisabledYellerClient |
data YellerClientErrorHandler Source
An error handler, for dealing with errors when sending errors to Yeller's servers
defaultErrorHandler
just prints to stderr when receiving errors, but you
might want to override that to make it go to your logging system of choice.
Constructors
YellerClientErrorHandler | |
Fields
|
data ApplicationEnvironment Source
The Environment your client is running in. If set to TestEnvironment
,
then no errors will be reported (which you should do for development/testing)
Constructors
TestEnvironment | Clients constructed with this environment don't send errors. |
ApplicationEnvironment Text | Any client in this kind of environment will report errors. |
newtype ApplicationPackage Source
The name of the package your application is in.
Constructors
ApplicationPackage Text |
newtype YellerToken Source
An api token. Get one from your project's settings page
Constructors
YellerToken Text |
data YellerClientSettings Source
Options you pass when creating a client, usually done like this:
client
(defaultClientSettings
{clientSettingsToken
=YellerToken
"YOUR_TOKEN_HERE" })
Constructors
YellerClientSettings | |
Fields
|
defaultClientSettings :: YellerClientSettings Source
The default client settings, used for constructing a client
defaultErrorHandler :: YellerClientErrorHandler Source
The default error handler, which logs errors when sending things to Yeller to stderr
defaultBackends :: [Text] Source
class (Typeable a, Show a) => ToError a where Source
A class for converting things into errors. Means you can pass both exceptions, and any other error like values in your code.
Methods
toError :: a -> ErrorNotification b -> ErrorNotification b Source
Instances
defaultToError :: (Typeable e, Show e) => e -> ErrorNotification b -> ErrorNotification b Source
parseStackLine :: String -> StackFrame Source
parseStackTrace :: [String] -> [StackFrame] Source
markInApp :: Text -> StackFrame -> StackFrame Source
filterInAppLines :: Text -> [StackFrame] -> [StackFrame] Source
sendError :: (ToError e, ToJSON a) => YellerClient -> e -> ExtraErrorInfo a -> IO () Source
Sends an error to Yeller's servers
needs a client, something that can be turned into an error (via ToError), and
extra error information (which describes additional information to be sent
along with the error). See ExtraErrorInfo
for the extra info, and client
for
how to create a client.
Sample invocation:
sendError yellerClient someError emptyExtraErrorInfo
sendNotification :: ToJSON a => YellerClient -> ErrorNotification a -> IO () Source
sendNotificationWithRetry :: ToJSON a => Int -> YellerClient -> ErrorNotification a -> ByteString -> IO () Source
handleNonExceptionalSendRequest :: ToJSON a => Response BodyReader -> Int -> YellerClient -> ErrorNotification a -> ByteString -> IO () Source
cycleBackends :: YellerClient -> IO Backend Source
cycleBackends_ :: [Backend] -> [Backend] Source
modifyTVar_ :: TVar a -> (a -> a) -> STM () Source
makeRequest :: YellerClient -> Backend -> ByteString -> IO Request Source
client :: YellerClientSettings -> IO YellerClient Source
Initializes a Yeller client, given some client settings Call it like this with the default client settings:
client
(defaultClientSettings
{clientSettingsToken
=YellerToken
"YOUR_TOKEN_HERE" })
shutdownClient :: YellerClient -> IO () Source