Skip to content

Fix the string representation of ServerDisconnectedError#4188

Merged
asvetlov merged 2 commits intoaio-libs:masterfrom
JenSte:server-disconnected-str
Oct 17, 2019
Merged

Fix the string representation of ServerDisconnectedError#4188
asvetlov merged 2 commits intoaio-libs:masterfrom
JenSte:server-disconnected-str

Conversation

@JenSte
Copy link
Copy Markdown
Contributor

@JenSte JenSte commented Oct 15, 2019

What do these changes do?

These changes make sure that the string representation of ServerDisconnectedError is always a valid, human readable string.

Are there changes in behavior for the user?

The user will never be surprised after calling str() on an instance of ServerDisconnectedError.

Related issue number

Fixes #4175.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES folder

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 15, 2019
Copy link
Copy Markdown
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe providing 'Server disconnected' default value for message could be enough:

if message is None:
    message = "Server disconnected"

__str__ is autogenerated from self.args[0].

@JenSte JenSte force-pushed the server-disconnected-str branch 2 times, most recently from 790fcc0 to 55d24f6 Compare October 16, 2019 18:36
@JenSte JenSte force-pushed the server-disconnected-str branch from 55d24f6 to 5c60941 Compare October 16, 2019 18:51
@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 16, 2019

Codecov Report

Merging #4188 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4188      +/-   ##
==========================================
- Coverage   97.57%   97.56%   -0.02%     
==========================================
  Files          43       43              
  Lines        8825     8825              
  Branches     1381     1381              
==========================================
- Hits         8611     8610       -1     
- Misses         92       93       +1     
  Partials      122      122
Impacted Files Coverage Δ
aiohttp/client_exceptions.py 100% <100%> (ø) ⬆️
aiohttp/web_fileresponse.py 97.72% <0%> (-0.57%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6236536...5c60941. Read the comment docs.

@asvetlov asvetlov merged commit a54956d into aio-libs:master Oct 17, 2019
@asvetlov
Copy link
Copy Markdown
Member

Thanks!

asvetlov pushed a commit that referenced this pull request Oct 17, 2019
asvetlov added a commit that referenced this pull request Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String representation of ServerDisconnectedError should be more meaningful

3 participants