Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Throw RuntimeException if FirePHP Class can't be found #2403

Closed
wants to merge 2 commits into from

3 participants

library/Zend/Log/Writer/FirePhp.php
@@ -94,7 +95,10 @@ public function getFirePhp()
// FirePHPService is an alias for FirePHP; otherwise the class
// names would clash in this file on this line.
$this->setFirePhp(new FirePhp\FirePhpBridge(new FirePHPService()));
+ } elseif (!class_exists('FirePHP')) {
+ throw new RuntimeException('FirePHP Class not found');

Bad indent here: 1 soft-tab = 4 spaces. And add, tag @throws in the DocBlock.

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

I don't know if we need an exception here. We broke the app for the logger :disappointed:

How we can be notify from an exception in the logger process with an another writer? Maybe trigger a warning instead...
Thought?

@rufinus

You are right, I thought about that problem too befor i commited the patch.

but FirePHP should only be used in dev instances. So breaking the logger may be not so a bad idea anymore.

@weierophinney

@b-durand It's standard throughout the framework that if a class depends on an extension or a third-party class, and that dependency is not found, we raise an exception.

@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney [ZF2-454][#2403] Logic tweaks
- Import Exception namespace, not individual exceptions
  - Update @throws annotation accordingly
- Throw early
19844a4
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney [ZF2-454][#2403] Logic tweaks
- Import Exception namespace, not individual exceptions
  - Update @throws annotation accordingly
- Throw early
2671b85
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/zf2-454'
Close #2403
23f4f58
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/zf2-454' into develop
Forward port #2403
7d598c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 21, 2012
  1. @rufinus
Commits on Sep 22, 2012
  1. @rufinus

    Update library/Zend/Log/Writer/FirePhp.php

    rufinus authored
    CS Fixes
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 library/Zend/Log/Writer/FirePhp.php
View
5 library/Zend/Log/Writer/FirePhp.php
@@ -13,6 +13,7 @@
use FirePHP as FirePHPService;
use Zend\Log\Formatter\FirePhp as FirePhpFormatter;
use Zend\Log\Logger;
+use Zend\Log\Exception\RuntimeException;
/**
* @category Zend
@@ -83,6 +84,7 @@ protected function doWrite(array $event)
* Gets the FirePhpInterface instance that is used for logging.
*
* @return FirePhp\FirePhpInterface
+ * @throws Zend\Log\Exception\RuntimeException
*/
public function getFirePhp()
{
@@ -94,7 +96,10 @@ public function getFirePhp()
// FirePHPService is an alias for FirePHP; otherwise the class
// names would clash in this file on this line.
$this->setFirePhp(new FirePhp\FirePhpBridge(new FirePHPService()));
+ } elseif (!class_exists('FirePHP')) {
+ throw new RuntimeException('FirePHP Class not found');
}
+
return $this->firephp;
}
Something went wrong with that request. Please try again.