From fe190c022e58b6ef791c28b12ec30a882a9ee0c1 Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Wed, 12 Jan 2022 12:48:04 +0100 Subject: [PATCH] test(restarts): add application crash button to admin test page --- src/Foundation/Yesod/ErrorHandler.hs | 6 +++++- src/Handler/Admin/Test.hs | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Foundation/Yesod/ErrorHandler.hs b/src/Foundation/Yesod/ErrorHandler.hs index af67f5b8b..52162aaac 100644 --- a/src/Foundation/Yesod/ErrorHandler.hs +++ b/src/Foundation/Yesod/ErrorHandler.hs @@ -16,6 +16,8 @@ import qualified Data.Text as Text import qualified Network.Wai as W +import System.Exit -- DEBUG: just for testing +import System.Posix.Process -- DEBUG: just for testing errorHandler :: ( MonadSecretBox (HandlerFor UniWorX) , MonadSecretBox (WidgetFor UniWorX) @@ -85,7 +87,9 @@ errorHandler err = do errPage = case err of NotFound -> [whamlet|

_{MsgErrorResponseNotFound}|] - InternalError err' -> encrypted err' [whamlet|

#{fromMaybe err' decrypted}|] + InternalError err' + | "Crash Button" `isPrefixOf` err' -> liftIO $ exitImmediately ExitSuccess -- DEBUG: just for Testing + | otherwise -> encrypted err' [whamlet|

TEST -#{err'}- -#{show decrypted}- #{fromMaybe err' decrypted}|] InvalidArgs errs -> [whamlet|