module Streamly.External.LMDB.Internal.Error where

import Control.Exception
import Text.Printf

data Error = Error !String !String

instance Show Error where
  show :: Error -> String
show (Error String
ctx String
msg) = String -> String -> ShowS
forall r. PrintfType r => String -> r
printf String
"streamly-lmdb; %s; %s" String
ctx String
msg

instance Exception Error

throwError :: String -> String -> m a
throwError :: forall (m :: * -> *) a. String -> String -> m a
throwError String
ctx String
msg = Error -> m a
forall a e. Exception e => e -> a
throw (Error -> m a) -> Error -> m a
forall a b. (a -> b) -> a -> b
$ String -> String -> Error
Error String
ctx String
msg