jenkins-bot has submitted this change and it was merged.

Change subject: Include original exception when throw TimestampException
......................................................................


Include original exception when throw TimestampException

Also adjust some spaces in exception messages.

Change-Id: I7bbe70f45aea49a2caaaeba82ab64e06b96347d0
---
M includes/Timestamp.php
1 file changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Parent5446: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Timestamp.php b/includes/Timestamp.php
index c77f9a4..94ff2f8 100644
--- a/includes/Timestamp.php
+++ b/includes/Timestamp.php
@@ -114,7 +114,7 @@
                        # asctime
                        $strtime = $ts;
                } else {
-                       throw new TimestampException( __METHOD__ . " : Invalid 
timestamp - $ts" );
+                       throw new TimestampException( __METHOD__ . ": Invalid 
timestamp - $ts" );
                }
 
                if ( !$strtime ) {
@@ -126,11 +126,11 @@
                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 @@
         */
        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 @@
                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 );
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/72527
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7bbe70f45aea49a2caaaeba82ab64e06b96347d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to