messageSpec = $messageSpec; // Exception->getMessage() should be in plain English, not localized. // So fetch the English version of the message, without local // customizations, and make a basic attempt to turn markup into text. $msg = $this->getMessageObject()->inLanguage( 'en' )->useDatabase( false )->text(); $msg = preg_replace( '!!', '"', $msg ); $msg = html_entity_decode( strip_tags( $msg ), ENT_QUOTES | ENT_HTML5 ); parent::__construct( $msg, $code, $previous ); } public function getMessageObject() { return Message::newFromSpecifier( $this->messageSpec ); } }