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

addEvents method does not throw exception on malformed data keys #135

Open
michaellehmkuhl opened this issue Jan 29, 2019 · 1 comment
Open

Comments

@michaellehmkuhl
Copy link

michaellehmkuhl commented Jan 29, 2019

I've just run into an unexpected behavior difference between the addEvent and addEvents methods.

In my instance, this call correctly throws the exception "Property name is invalid. Must be <= 256 characters, cannot contain the '.' symbol anywhere.":

// Throws exception
$client->addEvent('call', [
    'keen.timestamp' => $keenTimestamp,
    'call_type' => $type,
]);

To avoid the exception, the data should be formatted like so:

// No exception - valid data
$client->addEvent('call', [
    'keen' => ['timestamp' => $keenTimestamp],
    'call_type' => $type,
]);

But using the batch addEvents method, the same invalid format does not throw an exception. In my case, this caused a lot of confusion, because my events weren't showing up in the stream collection, even though addEvents apparently executed without error:

// No exception - in spite of invalid data
$client->addEvents(['call' => [
    [
        'keen.timestamp' => $keenTimestamp,
        'call_type' => $type,
    ]
]]);

Ideally, addEvents would throw the same sort of exception as addEvent in the case of malformed data.

@masojus
Copy link
Collaborator

masojus commented Mar 20, 2019

Thank you for reporting it. We'll take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants