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

When archiving fails with a SQL exception, also output the plugin name in the exception message to help troubleshooting #8604

Merged
merged 3 commits into from Aug 21, 2015

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Aug 20, 2015

fixes #8600

It should append eg - caused by plugin Actions. Not sure if there's a better way but seems to do the job.

An example output:

INFO [2015-08-20 09:35:47] Will pre-process for website id = 1, period = day, date = last52
INFO [2015-08-20 09:35:47] - pre-processing all visits
ERROR [2015-08-20 09:35:49] Got invalid response from API request: ?module=API&method=API.get&idSite=1&period=day&date=last52&format=php&trigger=archivephp. Response was 'a:2:{s:6:"result";s:5:"error";s:7:"message";s:127:"SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens - caused by plugin Actions";}'

@tsteur tsteur added Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Aug 20, 2015
@tsteur tsteur added this to the 2.15.0 milestone Aug 20, 2015
@tsteur tsteur added Needs Review PRs that need a code review and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Aug 20, 2015
);
} catch (Exception $e) {
$Klass = get_class($e);
$exception = new $Klass($e->getMessage() . " - caused by plugin $pluginName", $e->getCode(), $e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is $Klass a typo (ie, should it be $klass)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I wrote $Klass :) Think we used to do it like this in another project when it contained classname... will rename

@diosmosis
Copy link
Member

Is this something that can be tested? It would be good if we didn't regress this behaviour when refactoring the Archiver for 3.0.

Other than the above comment, looks good to me.

@tsteur
Copy link
Member Author

tsteur commented Aug 21, 2015

Added a test, will merge. Didn't want to write a test initially since it's maybe overdoing the testing part but might be helpful

tsteur added a commit that referenced this pull request Aug 21, 2015
When archiving fails with a SQL exception, also output the plugin name in the exception message to help troubleshooting
@tsteur tsteur merged commit aa8591b into master Aug 21, 2015
@tsteur tsteur deleted the 8600 branch August 21, 2015 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants