diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-08-20 22:36:43 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-08-20 22:36:43 +0200 |
| commit | 14cc805dcfce79ab699ebb83261749a3a1c227fd (patch) | |
| tree | 34e863241d05cf9fec44b5516e2f78c911d570ae /lib | |
| parent | 42b9b671e1db2ac182ad504b14da9a0f6bb2ff1a (diff) | |
| download | slackbuilder-14cc805dcfce79ab699ebb83261749a3a1c227fd.tar.gz | |
Display error descriptions
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/SlackBuilder/Trans.hs | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/SlackBuilder/Trans.hs b/lib/SlackBuilder/Trans.hs index 3ab162c..515c1d4 100644 --- a/lib/SlackBuilder/Trans.hs +++ b/lib/SlackBuilder/Trans.hs @@ -11,12 +11,14 @@ module SlackBuilder.Trans import Control.Monad.Trans.Reader (ReaderT(..), asks) import Data.Text (Text) +import qualified Data.Text as Text import SlackBuilder.Config import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.Catch (MonadCatch(..), MonadThrow(..)) import Control.Exception (Exception(..)) import System.FilePath ((</>)) import Text.URI (URI) +import qualified Text.URI as URI import qualified Codec.Compression.Lzma as Lzma data SlackBuilderException @@ -26,7 +28,34 @@ data SlackBuilderException deriving Show instance Exception SlackBuilderException - + where + displayException (UpdaterNotFound updateName) = Text.unpack + $ Text.concat ["Requested package \"", updateName, "\" was not found"] + displayException (HttpsUrlExpected givenURI) = Text.unpack + $ "Only https URLs are supported, got: " <> URI.render givenURI + displayException (LzmaDecompressionFailed Lzma.LzmaRetOK) = + "Operation completed successfully" + displayException (LzmaDecompressionFailed Lzma.LzmaRetStreamEnd) = + "End of stream was reached" + displayException (LzmaDecompressionFailed Lzma.LzmaRetUnsupportedCheck) = + "Cannot calculate the integrity check" + displayException (LzmaDecompressionFailed Lzma.LzmaRetGetCheck) = + "Integrity check type is now available" + displayException (LzmaDecompressionFailed Lzma.LzmaRetMemError) = + "Cannot allocate memory" + displayException (LzmaDecompressionFailed Lzma.LzmaRetMemlimitError) = + "Memory usage limit was reached" + displayException (LzmaDecompressionFailed Lzma.LzmaRetFormatError) = + "File format not recognized" + displayException (LzmaDecompressionFailed Lzma.LzmaRetOptionsError) = + "Invalid or unsupported options" + displayException (LzmaDecompressionFailed Lzma.LzmaRetDataError) = + "Data is corrupt" + displayException (LzmaDecompressionFailed Lzma.LzmaRetBufError) = + "No progress is possible" + displayException (LzmaDecompressionFailed Lzma.LzmaRetProgError) = + "Programming error" + newtype SlackBuilderT a = SlackBuilderT { runSlackBuilderT :: ReaderT Settings IO a } |
