From: umherirrender Date: Mon, 8 Jul 2013 15:08:27 +0000 (+0200) Subject: Include original exception when throw TimestampException X-Git-Tag: 1.31.0-rc.0~19239^2 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=251f82eff44e1a97e230cebfeb5643e8f9a69790;p=lhc%2Fweb%2Fwiklou.git Include original exception when throw TimestampException Also adjust some spaces in exception messages. Change-Id: I7bbe70f45aea49a2caaaeba82ab64e06b96347d0 --- diff --git a/includes/Timestamp.php b/includes/Timestamp.php index c77f9a4835..94ff2f8d58 100644 --- a/includes/Timestamp.php +++ b/includes/Timestamp.php @@ -114,7 +114,7 @@ class MWTimestamp { # asctime $strtime = $ts; } else { - throw new TimestampException( __METHOD__ . " : Invalid timestamp - $ts" ); + throw new TimestampException( __METHOD__ . ": Invalid timestamp - $ts" ); } if ( !$strtime ) { @@ -126,11 +126,11 @@ class MWTimestamp { try { $final = new DateTime( $strtime, new DateTimeZone( 'GMT' ) ); } catch ( Exception $e ) { - throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' ); + throw new TimestampException( __METHOD__ . ': Invalid timestamp format.', $e->getCode(), $e ); } if ( $final === false ) { - throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' ); + throw new TimestampException( __METHOD__ . ': Invalid timestamp format.' ); } $this->timestamp = $final; } @@ -149,7 +149,7 @@ class MWTimestamp { */ public function getTimestamp( $style = TS_UNIX ) { if ( !isset( self::$formats[$style] ) ) { - throw new TimestampException( __METHOD__ . ' : Illegal timestamp output type.' ); + throw new TimestampException( __METHOD__ . ': Illegal timestamp output type.' ); } $output = $this->timestamp->format( self::$formats[$style] ); @@ -301,7 +301,7 @@ class MWTimestamp { try { $this->timestamp->setTimezone( new DateTimeZone( $timezone ) ); } catch ( Exception $e ) { - throw new TimestampException( __METHOD__ . ' Invalid timezone.' ); + throw new TimestampException( __METHOD__ . ': Invalid timezone.', $e->getCode(), $e ); } }