Skip to content

Commit

Permalink
Merge pull request #6 from mcci-catena/issue5
Browse files Browse the repository at this point in the history
Fix #5: use _fatal when we can't continue
  • Loading branch information
terrillmoore authored Mar 20, 2022
2 parents 8e82e82 + 267b5f7 commit ff988e4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions build-with-cli-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ function _setDefaults {
# Override this function with one of your own
##############################################################################
function _setProject {
_error "You must provide your own _setProject function"
_fatal "You must provide your own _setProject function"
}

##############################################################################
# Check that project settings are complete
##############################################################################
function _checkProject {
#---- project settings -----
[[ -n "$OPTKEYFILE_DEFAULT" ]] || _error "OPTKEYFILE_DEFAULT must be set to a suitable default keyfile location (.pem)"
[[ -n "$OPTREGION_DEFAULT" ]] || _error "OPTREGION_DEFAULT must be set to a value from MCCI_ARDUINO_BOOTLOADER_LIST"
[[ -n "$OPTNETWORK_DEFAULT" ]] || _error "OPTNETWORK_DEFAULT must be set to a target network"
[[ -n "$OPTSUBBAND_DEFAULT" ]] || _error "OPTSUBBAND_DEFAULT must be set"
[[ -n "$OPTCLOCK_DEFAULT" ]] || _error "OPTCLOCK_DEFAULT must be set"
[[ -n "$OPTXSERIAL_DEFAULT" ]] || _error "OPTXSERIAL_DEFAULT must be set"
[[ -n "$OPTARDUINO_BOARD_DEFAULT" ]] || _error "OPTARDUINO_BOARD_DEFAULT must be set"
[[ -n "$OPTARDUINO_SOURCE_DEFAULT" ]] || _error "OPTARDUINO_SOURCE_DEFAULT must be set"
[[ -n "$OPTOUTPUTNAME_DEFAULT" ]] || _error "OPTOUTPUTNAME_DEFAULT must be set"
[[ -n "$OPTKEYFILE_DEFAULT" ]] || _fatal "OPTKEYFILE_DEFAULT must be set to a suitable default keyfile location (.pem)"
[[ -n "$OPTREGION_DEFAULT" ]] || _fatal "OPTREGION_DEFAULT must be set to a value from MCCI_ARDUINO_BOOTLOADER_LIST"
[[ -n "$OPTNETWORK_DEFAULT" ]] || _fatal "OPTNETWORK_DEFAULT must be set to a target network"
[[ -n "$OPTSUBBAND_DEFAULT" ]] || _fatal "OPTSUBBAND_DEFAULT must be set"
[[ -n "$OPTCLOCK_DEFAULT" ]] || _fatal "OPTCLOCK_DEFAULT must be set"
[[ -n "$OPTXSERIAL_DEFAULT" ]] || _fatal "OPTXSERIAL_DEFAULT must be set"
[[ -n "$OPTARDUINO_BOARD_DEFAULT" ]] || _fatal "OPTARDUINO_BOARD_DEFAULT must be set"
[[ -n "$OPTARDUINO_SOURCE_DEFAULT" ]] || _fatal "OPTARDUINO_SOURCE_DEFAULT must be set"
[[ -n "$OPTOUTPUTNAME_DEFAULT" ]] || _fatal "OPTOUTPUTNAME_DEFAULT must be set"
true
}

Expand Down Expand Up @@ -127,7 +127,7 @@ function _error {

#### _fatal: print an error message and then exit the script.
function _fatal {
_error "$@" ; exit 1
_error "fatal error:" "$@" ; exit 1
}

##############################################################################
Expand Down Expand Up @@ -380,7 +380,7 @@ function _setupOutput {
else
OUTPUT_SLUG="${OPTOUTPUTNAME_DEFAULT}-${OUTPUT_SIG}"
fi
[[ -n "$OUTPUT_SLUG" ]] || _error "Internal error: empty OUTPUT_SLUG"
[[ -n "$OUTPUT_SLUG" ]] || _fatal "Internal error: empty OUTPUT_SLUG"
OUTPUT_ROOT="$(realpath "$INVOKEDIR/build")/$OUTPUT_SLUG"
_verbose "output tree:" "$OUTPUT_ROOT"
OUTPUT="${OUTPUT_ROOT}/ide"
Expand Down

0 comments on commit ff988e4

Please sign in to comment.