Remove uses of deprecated BaseException.message.

`format_error` access `APIError.message` which resolves to the deprecated `BaseException.message` attribute. `APIError` should get its own explicit `message` attribute.