Skip to content

Commit dd5ec67

Browse files
committed
Gracefully handle signature change on overcommit --run
We were dumping a stack trace for `overcommit --run` when the configuration file signature had changed since. This isn't a great user experience, so handle the error and print the error message properly.
1 parent 5a0a4ec commit dd5ec67

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/overcommit/cli.rb

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def run
2727
when :run_all
2828
run_all
2929
end
30+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => ex
31+
puts ex
32+
exit 78 # EX_CONFIG
3033
rescue Overcommit::Exceptions::HookContextLoadError => ex
3134
puts ex
3235
exit 64 # EX_USAGE

lib/overcommit/configuration_loader.rb

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def load_file(file)
6868
end
6969

7070
config
71+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged
72+
raise
7173
rescue => error
7274
raise Overcommit::Exceptions::ConfigurationError,
7375
"Unable to load configuration from '#{file}': #{error}",

0 commit comments

Comments
 (0)