summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-04-01 12:35:42 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-07 13:30:30 +0200
commita57918fb10a85e27aa283eb4abb39d57e718035c (patch)
treef3fb6ab3dc53f65ac281ab4b2729c3b07ec57f72 /lib
parent137c13566499beb70a099162919c02146136f020 (diff)
downloadnextcloud-server-a57918fb10a85e27aa283eb4abb39d57e718035c.tar.gz
nextcloud-server-a57918fb10a85e27aa283eb4abb39d57e718035c.zip
Hook: fixing error message in exception case
Diffstat (limited to 'lib')
-rw-r--r--lib/private/hook.php23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/private/hook.php b/lib/private/hook.php
index d2a0fa898dd..824bb725077 100644
--- a/lib/private/hook.php
+++ b/lib/private/hook.php
@@ -72,8 +72,9 @@ class OC_Hook{
/**
* emits a signal
- * @param string $signalclass class name of emitter
- * @param string $signalname name of signal
+ *
+ * @param string $signalClass class name of emitter
+ * @param string $signalName name of signal
* @param mixed $params default: array() array with additional data
* @return bool true if slots exists or false if not
*
@@ -81,28 +82,36 @@ class OC_Hook{
*
* TODO: write example
*/
- static public function emit( $signalclass, $signalname, $params = array()) {
+ static public function emit($signalClass, $signalName, $params = array()) {
// Return false if no hook handlers are listening to this
// emitting class
- if( !array_key_exists( $signalclass, self::$registered )) {
+ if( !array_key_exists($signalClass, self::$registered )) {
return false;
}
// Return false if no hook handlers are listening to this
// emitting method
- if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
+ if( !array_key_exists( $signalName, self::$registered[$signalClass] )) {
return false;
}
// Call all slots
- foreach( self::$registered[$signalclass][$signalname] as $i ) {
+ foreach( self::$registered[$signalClass][$signalName] as $i ) {
try {
call_user_func( array( $i["class"], $i["name"] ), $params );
} catch (Exception $e){
self::$thrownExceptions[] = $e;
+ $class = $i["class"];
+ if (is_object($i["class"])) {
+ $class = get_class($i["class"]);
+ }
+ $message = $e->getMessage();
+ if (empty($message)) {
+ $message = get_class($e);
+ }
OC_Log::write('hook',
- 'error while running hook (' . $i["class"] . '::' . $i["name"] . '): '.$e->getMessage(),
+ 'error while running hook (' . $class . '::' . $i["name"] . '): ' . $message,
OC_Log::ERROR);
}
}