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

('experience_bonus',), 'msg': 'value is not a valid integer', 'type': 'type_error.integer'}])> #50

Closed
dbrennand opened this issue May 14, 2021 · 2 comments
Labels
bug Something isn't working prio:high Fix as soon as possible

Comments

@dbrennand
Copy link

Hi, I'm using a slightly modified version of a snippet of code from the README.

I have altered: @client.trigger(event.BattleRankUp) to @client.trigger(event.MetagameEvent).

Here is my code:

import asyncio
from auraxium import event, ps2

async def main():

    # Initialise event streaming client to the Planetside 2 Census API
    client = event.EventClient(service_id="s:example")

    # Register client trigger
    @client.trigger(event.MetagameEvent)
    async def show_event(evt):
        print(repr(evt))
        print(evt)


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.create_task(main())
    loop.run_forever()

However, the following error occurs on when an event is received:

auraxium\event\_client.py:167> exception=ValidationError(model='MetagameEvent', errors=[{'loc': ('experience_bonus',), 'msg': 'value is not a valid integer', 'type': 'type_error.integer'}])>

Is my usage incorrect?

@dbrennand dbrennand changed the title BUG: BUG: ('experience_bonus',), 'msg': 'value is not a valid integer', 'type': 'type_error.integer'}])> May 14, 2021
@dbrennand dbrennand changed the title BUG: ('experience_bonus',), 'msg': 'value is not a valid integer', 'type': 'type_error.integer'}])> ('experience_bonus',), 'msg': 'value is not a valid integer', 'type': 'type_error.integer'}])> May 14, 2021
@leonhard-s
Copy link
Owner

leonhard-s commented May 15, 2021

Hi, this looks like a problem with pydantic, not your code.

Auraxium uses a pydantic model for all messages it receives to validate and parse them into the object model representation. This gem of a message is its way of complaining about bad types. I have created an issue for this lack of information; this really should not result in a user-facing error message as this is not provoked by your code (#51).

It looks like there are alerts whose experience type is a float or other non-integer type. I started logging a session, but it might take a while before we get an alert violating the constraint. I confirmed that this was the issue, a fix is underway.

@leonhard-s leonhard-s added bug Something isn't working prio:high Fix as soon as possible labels May 15, 2021
@leonhard-s
Copy link
Owner

The issue with your snippet has been resolved. Similar data model incompatibilities should now also result in a more helpful error message that also includes the offending payload to make correcting the model faster.
Thank you for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working prio:high Fix as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants