mbed dm: Check for missing payload and give a better error message

### Description

The error message when you invoke `mbed dm update prepare` without a payload
is particularly obtuse, and provides a user with no indication that the
payload is missing. This change makes that error message not stink.

### Pull request type

    [x] Fix
    [ ] Refactor
    [ ] Target update
    [ ] Functionality change
    [ ] Breaking change
pull/8334/head
Jimmy Brisson 2018-10-05 13:21:55 -05:00
parent 1af1a4a443
commit eb86233a11
1 changed files with 3 additions and 0 deletions

View File

@ -83,6 +83,9 @@ def wrap_payload(func):
app_name, output_ext
))
options.payload = open(payload_name, "rb")
if not options.payload:
LOG.error("No Payload specified. Please use \"-t\" and \"-m\" or \"-p\" to specify a payload ")
exit(1)
return func(options)
return inner