Skip to content

Commit 5b0811e

Browse files
committed
Fail the build with a helpful message on unrecoverable arduino command failures
1 parent 13bc7a1 commit 5b0811e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111
- Minimal Wire mocks. Will not provide support for unit testing I2C communication yet, but will allow compilation of libraries that use I2C.
1212

1313
### Changed
14+
- Arduino command failures (to read preferences) now causes a fatal error, with help for troubleshooting the underlying command
1415

1516
### Deprecated
1617

lib/arduino_ci/arduino_cmd.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
module ArduinoCI
88

9+
# To report errors that we can't resolve or possibly even explain
10+
class ArduinoExecutionError < StandardError; end
11+
912
# Wrap the Arduino executable. This requires, in some cases, a faked display.
1013
class ArduinoCmd
1114

@@ -82,7 +85,8 @@ def lib_dir
8285
# @return [String] Preferences as a set of lines
8386
def _prefs_raw
8487
resp = run_and_capture(flag_get_pref)
85-
return nil unless resp[:success]
88+
fail_msg = "Arduino binary failed to operate as expected; you will have to troubleshoot it manually"
89+
raise ArduinoExecutionError, "#{fail_msg}. The command was #{@last_msg}" unless resp[:success]
8690

8791
@prefs_fetched = true
8892
resp[:out]

0 commit comments

Comments
 (0)