From c738bc5eba76d463d0b0a198386db9f146c4f5ca Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Mon, 6 Jun 2022 11:55:43 +0200 Subject: [PATCH] Print exception message and exit 1 --- bin/git-format-staged | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/git-format-staged b/bin/git-format-staged index 5195cfa..41d0829 100755 --- a/bin/git-format-staged +++ b/bin/git-format-staged @@ -73,5 +73,10 @@ if !parameters[:formatter] || parameters[:patterns].empty? exit end -success = FormatStaged.run(**parameters) -exit success ? 0 : 1 +begin + success = FormatStaged.run(**parameters) + exit success ? 0 : 1 +rescue RuntimeError => e + puts "💣 Error: #{e.message}".red + exit 1 +end