summaryrefslogtreecommitdiff
path: root/deps/discord-haskell/docs/debugging.md
blob: 5576a5579db88ca1c8a3192f5986ba45148bc3a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

### Debugging


```haskell
example :: IO ()
example = do userFacingError <- runDiscord $ def
                 { discordToken = "Bot ZZZZZZZZZZZZZZZZZZZ"

            --     discordOnLog :: T.Text -> IO ()
                 , discordOnLog = \s -> TIO.putStrLn s >> TIO.putStrLn ""
                 }

             -- userFacingError :: T.Text
             TIO.putStrLn userFacingError

```


1. Always print the `userFacingError` Text returned from `runDiscord`. This is used for errors that cannot be recovered from.

2. Use the `discordOnLog` handler to print debugging information as it happens.


If something else goes wrong with the library please open an issue. It is helpful,
but not always necessary, to attach a log.

Assign a handler to the `discordOnLog :: Text -> IO ()` to print info as it happens.
Remember to remove sensitive information before posting.