Choqs opened a new issue, #16056:
URL: https://github.com/apache/pulsar/issues/16056

   ### Describe the bug
   
   Using python pulsar-client, instantiating a schema with an array of a wrong 
type, leads exception to throw another exception. This make it harder to debug 
and understand what is wrong for the user.
   
   ### How to reproduce
   
   ```python
   from pulsar.schema import Integer, Array, Record
   
   
   class SomeSchema(Record):
       some_field = Array(Integer(), required=False, default=[])
   
   
   # All good
   some_schema = SomeSchema()
   
   # Still all good
   some_schema = SomeSchema(some_field=[1, 2, 3])
   
   # Exception not super descriptive
   some_schema = SomeSchema(some_field=["not", "integer"])
   ``` 
   
   This script will give the below traceback :
   
   ```
   ...
       raise TypeError('Array field ' + name + ' items should all be of type '
   TypeError: can only concatenate str (not "type") to str
   ```
   
   Instead of :
   
   ```
       raise TypeError('Array field ' + name + ' items should all be of type '
   TypeError: Array field some_schema items should all be of type Integer
   ```
   
   ### Environment
   
   - pulsar-client==2.8.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to