restyler-0.2.0.0
Safe HaskellNone
LanguageHaskell2010

Restyler.App.Error

Synopsis

Documentation

data AppError Source #

Constructors

PullRequestFetchError Error

We couldn't fetch the PullRequest to restyle

PullRequestCloneError IOException

We couldn't clone or checkout the PR's branch

ConfigurationError ConfigError

We couldn't load a .restyled.yaml

RestylerExitFailure Restyler Int [FilePath]

A Restyler we ran exited non-zero on the given paths

RestyleError Text

Unable to Restyle for a known reason (given as user-facing message)

GitHubError DisplayGitHubRequest Error

We encountered a GitHub API error during restyling

SystemError IOException

Trouble reading a file or etc

HttpError IOException

Trouble performing some HTTP request

OtherError SomeException

Escape hatch for anything else

Instances

Instances details
Show AppError Source # 
Instance details

Defined in Restyler.App.Error

Exception AppError Source # 
Instance details

Defined in Restyler.App.Error

mapAppError :: (MonadUnliftIO m, Exception e) => (e -> AppError) -> m a -> m a Source #

Run a computation, and modify any thrown exceptions to AppErrors

Error handling

errorPullRequest :: (HasLogFunc env, HasOptions env, HasConfig env, HasPullRequest env, HasGitHub env) => SomeException -> RIO env () Source #

Error the original PullRequest and re-throw the exception

dieAppErrorHandlers :: [Handler IO ()] Source #

Error handlers for overall execution

Usage:

{- main routine -} `catches` dieAppErrorHandlers

Ensures all exceptions (besides ExitCodes) go through:

dieAppError

Lower-level helpers

warnIgnore :: (Display a, HasLogFunc env) => a -> RIO env () Source #

Ignore an exception, warning about it.