Skip to content

Commit d062347

Browse files
committed
Make signalFence be an exception with a stack trace and internal message
1 parent 16bd058 commit d062347

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/General/Fence.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module General.Fence(
66

77
import Control.Monad
88
import Control.Monad.IO.Class
9+
import Control.Exception.Extra
10+
import Development.Shake.Internal.Errors
911
import Data.Maybe
1012
import Data.Either.Extra
1113
import Data.IORef
@@ -21,10 +23,10 @@ instance Show (Fence m a) where show _ = "Fence"
2123
newFence :: MonadIO m => IO (Fence m a)
2224
newFence = Fence <$> newIORef (Left $ const $ return ())
2325

24-
signalFence :: MonadIO m => Fence m a -> a -> m ()
26+
signalFence :: (Partial, MonadIO m) => Fence m a -> a -> m ()
2527
signalFence (Fence ref) v = join $ liftIO $ atomicModifyIORef' ref $ \x -> case x of
2628
Left queue -> (Right v, queue v)
27-
Right _ -> error "Shake internal error, signalFence called twice on one Fence"
29+
Right _ -> throwImpure $ errorInternal "signalFence called twice on one Fence"
2830

2931
waitFence :: MonadIO m => Fence m a -> (a -> m ()) -> m ()
3032
waitFence (Fence ref) call = join $ liftIO $ atomicModifyIORef' ref $ \x -> case x of

0 commit comments

Comments
 (0)