Simplify exception catching of punycode encodes
authorJoshua Rüsweg <ruesweg@woltlab.com>
Thu, 26 Sep 2019 13:43:33 +0000 (15:43 +0200)
committerJoshua Rüsweg <ruesweg@woltlab.com>
Thu, 26 Sep 2019 13:43:59 +0000 (15:43 +0200)
See 7951824093fe2996ee90f4d1f60075eae4b965d9

wcfsetup/install/files/lib/system/email/Mailbox.class.php

index 31a3c1c9eaa69f1814392ceec8b6220e2974bccf..048d4499c748ee26d2ba0fbffb7b1ef2ac07ea8a 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 namespace wcf\system\email;
-use TrueBV\Exception\DomainOutOfBoundsException;
-use TrueBV\Exception\LabelOutOfBoundsException;
+use TrueBV\Exception\OutOfBoundsException;
 use TrueBV\Punycode;
 use wcf\data\language\Language;
 use wcf\system\language\LanguageFactory;
@@ -63,11 +62,8 @@ class Mailbox {
                        // punycode the domain ...
                        $domain = (new Punycode())->encode($domain);
                }
-               catch (LabelOutOfBoundsException $e) {
-                       throw new \DomainException($e->getMessage());
-               }
-               catch (DomainOutOfBoundsException $e) {
-                       throw new \DomainException($e->getMessage());
+               catch (OutOfBoundsException $e) {
+                       throw new \DomainException($e->getMessage(), 0, $e);
                }
                
                // ... and rebuild address.