Skip to content

Commit

Permalink
Error instance for FileError instead of Pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Nov 17, 2023
1 parent b801e3b commit 926215b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cardano-api/internal/Cardano/Api/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ data FileError e = FileError FilePath e
| FileIOError FilePath IOException
deriving (Show, Eq, Functor)

instance Error e => Pretty (FileError e) where
pretty = \case
instance Error e => Error (FileError e) where
prettyError = \case
FileErrorTempFile targetPath tempPath h ->
vsep
[ "Error creating temporary file at: " <> pretty tempPath
Expand Down
2 changes: 2 additions & 0 deletions cardano-api/internal/Cardano/Api/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import qualified Data.Text.Lazy as TextLazy
import Prettyprinter
import Prettyprinter.Render.Terminal

-- | 'Ann' is the prettyprinter annotation for cardano-api and cardano-cli to enable the printing
-- of colored output. This is a type alias for AnsiStyle.
type Ann = AnsiStyle

newtype ShowOf a = ShowOf a
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/test/cardano-api-test/Test/Cardano/Api/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ prop_createVrfFileWithOwnerPermissions =
result <- liftIO $ writeLazyByteStringFileWithOwnerPermissions (File file) ""

case result of
Left err -> failWith Nothing $ prettyToString $ pretty @(FileError ()) err
Left err -> failWith Nothing $ prettyToString $ prettyError @(FileError ()) err
Right () -> return ()

fResult <- liftIO . runExceptT $ checkVrfFilePermissions (File file)
Expand Down

0 comments on commit 926215b

Please sign in to comment.