Skip to content

Make bytes mode TypeError more useful #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2018

Conversation

tiran
Copy link
Member

@tiran tiran commented Jan 11, 2018

It's a bit hard to understand where the TypeError excactly comes from.
The exception now contains the argument name.

Signed-off-by: Christian Heimes cheimes@redhat.com

@codecov
Copy link

codecov bot commented Jan 11, 2018

Codecov Report

Merging #165 into master will increase coverage by <.01%.
The diff coverage is 21.87%.

@@            Coverage Diff             @@
##           master     #165      +/-   ##
==========================================
+ Coverage    69.6%   69.61%   +<.01%     
==========================================
  Files          49       49              
  Lines        4731     4732       +1     
  Branches      817      817              
==========================================
+ Hits         3293     3294       +1     
  Misses       1084     1084              
  Partials      354      354
Impacted Files Coverage Δ
Modules/functions.c 61.66% <0%> (ø) ⬆️
Lib/ldap/ldapobject.py 71.57% <100%> (ø) ⬆️
Modules/LDAPObject.c 67.69% <12%> (ø) ⬆️
Modules/ldapcontrol.c 57.69% <50%> (+0.23%) ⬆️

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 ad46c11...52fc21d. Read the comment docs.

It's a bit hard to understand where the TypeError excactly comes from.
The exception now contains the argument name.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
raise TypeError(
"All provided fields *must* be bytes when bytes mode is on; "
"got {}={!r}".format(arg_name, value)
)
Copy link
Member

Choose a reason for hiding this comment

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

We did a similar thing with the warnings, but removed the value altogether.
Error messages might end up in logs as well; how would you feel about only mentioning the arg_name?

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@encukou encukou merged commit e148184 into python-ldap:master Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy