Skip to content

Bug: Improve error description #147

@yanivbh1

Description

@yanivbh1

Describe the bug

Hey,
I was trying to produce a protobuf dict to a station without schema attached and received the following error:

$ python3 producer-protobuf.py
memphis: Unsupported message type

That error should be something like:

$ python3 producer-protobuf.py
memphis: Unsupported message type.
Potential issues:
- Memphis requires an array of bytes to produce a binary format into the broker.
- If you want to use protobuf and other supported formats within Schemaverse, please attach a schema to the station.

Steps to reproduce

from __future__ import annotations
import asyncio
from memphis import Memphis, Headers, MemphisError, MemphisConnectError, MemphisHeaderError, MemphisSchemaError
import entity_pb2 as ENTITY

async def main():
    try:
        memphis = Memphis()
        await memphis.connect(host="localhost", username="root", password="memphis")
        
        producer = await memphis.producer(station_name="benchmark", producer_name="protobuf-producer") # you can send the message parameter as dict as well
        
        obj = ENTITY.Entity()
        obj.identifier = 1
        obj.description = "Amazing"

        for i in range(5):
            await producer.produce(obj)
        
    except (MemphisError, MemphisConnectError, MemphisHeaderError, MemphisSchemaError) as e:
        print(e)
        
    finally:
        await memphis.close()
        
if __name__ == "__main__":
    asyncio.run(main())

Affected services

Broker, SDKs

Platforms

No response

If UI - Browsers

No response

Environment

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions