Closed Bug 1374917 Opened 3 years ago Closed 3 years ago

AttributeError: 'MaxRetryError' object has no attribute 'format' on errors during `mach artifact toolchain`

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox55 fixed, firefox56 fixed)

RESOLVED FIXED
mozilla56
Tracking Status
firefox55 --- fixed
firefox56 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file)

This doesn't lead to failures, but hides the real error message:

Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 861, in emit
    msg = self.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 734, in format
    return fmt.format(record)
  File "/home/glandium/gecko-push/python/mach/mach/logging.py", line 100, in format
    f = record.msg.format(**record.params)
AttributeError: 'MaxRetryError' object has no attribute 'format'
Logged from file logging.py, line 54
This is reproducible manually with e.g. the following command:

  ./mach artifact toolchain -v --tooltool-manifest browser/config/tooltool-manifests/linux64/releng.manifest --tooltool-url https://localhost/ --retry 1 --skip-cache

(assuming no https server is running on localhost)
Duplicate of this bug: 1375574
Comment on attachment 8879806 [details]
Bug 1374917 - Convert exception messages from the requests module before logging them.

https://reviewboard.mozilla.org/r/151196/#review156916

::: python/mozbuild/mozbuild/mach_commands.py:1798
(Diff revision 1)
>                      if should_retry or attempt < retry:
>                          level = logging.WARN
>                      else:
>                          level = logging.ERROR
> -                    self.log(level, 'artifact', {}, e.message)
> +                    # e.message is not always a string, so convert it first.
> +                    self.log(level, 'artifact', {}, str(e.message))

Wouldn't it be better to str(e)? Even better would be to call `Logger.exception(e)`, which knows how to format Exception instances.

But this patch will get the job done. So r+. Scope bloat only if you want to.
Attachment #8879806 - Flags: review?(gps) → review+
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/5397969abbed
Convert exception messages from the requests module before logging them. r=gps
https://hg.mozilla.org/mozilla-central/rev/5397969abbed
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Whiteboard: [checkin-needed-beta]
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.