Skip to content

catch exceptions#3

Open
navihtot wants to merge 1 commit intofelixmaier1989:masterfrom
navihtot:fail-gracefully
Open

catch exceptions#3
navihtot wants to merge 1 commit intofelixmaier1989:masterfrom
navihtot:fail-gracefully

Conversation

@navihtot
Copy link
Copy Markdown

There were some max execution timeout exception on graylog

$this->cache[$method][$cache_key] = $output;
try {
$cache_key = $this->getCacheKey($args);
$this->cache[$method][$cache_key] = $output;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'd like to have one test case. Could you identify which line did throw the exception you found in the logs, and then stub it like here: https://stackoverflow.com/questions/45905183/mocking-methods-to-throw-error-phpunit
You may have to move $this->cache[$method][$cache_key] = $output; to a sub function.

$cache_key = $this->getCacheKey($args);
$this->cache[$method][$cache_key] = $output;
try {
$cache_key = $this->getCacheKey($args);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Would be nice to have getCacheKey() having its own try/catch block and return false if exception is thrown.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants