Skip to content
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

to_string primitive raise exception when decode non string value, instead return error result #54

Closed
s-m-i-t-a opened this issue Oct 9, 2017 · 0 comments · Fixed by #55
Assignees

Comments

@s-m-i-t-a
Copy link
Contributor

  • PyDecoder version: 1.0.1
  • Python version: ANY
  • Operating System: ANY

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

What I Did

from pydecoder.json import to_string

to_string(1234)

TypeError                                 Traceback (most recent call last)
<ipython-input-31-379c7824c645> in <module>()
----> 1 to_string(1234)

~/projects/python/pydecoder/pydecoder/primitives.py in to_string(val)
     30         return error(u'Can\'t be null')
     31
---> 32     return ok(val) if isinstance(val, text_type) else ok(text_type(val, 'utf-8'))
     33
     34

TypeError: decoding to str: need a bytes-like object, int found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant