Add FailedCommandError(message, exit_code) s.t. mach won't print a stack-trace

RESOLVED FIXED in Firefox 57

Status

RESOLVED FIXED
a year ago
8 months ago

People

(Reporter: jonasfj, Assigned: jonasfj)

Tracking

unspecified
mozilla57

Firefox Tracking Flags

(firefox57 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

a year ago
Simply a way to communicate expected errors nicely without littering our code
with:
  print(...)
  sys.exit(1)

which makes it hard to reuse code for anything other than the command it was written for.
Comment hidden (mozreview-request)
(Assignee)

Updated

a year ago
Attachment #8893638 - Flags: review?(gps)

Comment 2

a year ago
mozreview-review
Comment on attachment 8893638 [details]
Bug 1387307 - Add FailedCommandError to mach

https://reviewboard.mozilla.org/r/164740/#review170954

::: python/mach/mach/main.py:457
(Diff revision 1)
>              return Registrar._run_command_handler(handler, context=context,
>                  debug_command=args.debug_command, **vars(args.command_args))
>          except KeyboardInterrupt as ki:
>              raise ki
> +        except FailedCommandError as e:
> +            print(e.message, file=sys.stderr)

While stderr is arguably the correct destination, other error handling code in this file writes to stdout. So let's drop `file=sys.stderr` and write to stdout.
Attachment #8893638 - Flags: review?(gps) → review+
Comment hidden (mozreview-request)
(Assignee)

Updated

a year ago
Assignee: nobody → jopsen
Keywords: checkin-needed

Comment 4

a year ago
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f5a478a70af0
Add FailedCommandError to mach r=gps
Keywords: checkin-needed

Comment 5

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/f5a478a70af0
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57

Updated

8 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.