X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FTwitterBridge%2Fjsonstreamreader.php;h=d5852c93e3fabd40c35122e545bc9d62b35d0e6f;hb=b5e1cf13e668a739a226c72c4e446c809e7af553;hp=f6572c9eefafbae4aafd993de2bdfbf528967c00;hpb=407663fb402f0384cced2b63a2f901d19ab71d19;p=quix0rs-gnu-social.git diff --git a/plugins/TwitterBridge/jsonstreamreader.php b/plugins/TwitterBridge/jsonstreamreader.php index f6572c9eef..d5852c93e3 100644 --- a/plugins/TwitterBridge/jsonstreamreader.php +++ b/plugins/TwitterBridge/jsonstreamreader.php @@ -63,7 +63,8 @@ abstract class JsonStreamReader } else if ($scheme == 'https') { $rawScheme = 'ssl'; } else { - throw new ServerException('Invalid URL scheme for HTTP stream reader'); + // TRANS: Server exception thrown when an invalid URL scheme is detected. + throw new ServerException(_m('Invalid URL scheme for HTTP stream reader.')); } $host = parse_url($url, PHP_URL_HOST); @@ -180,7 +181,8 @@ abstract class JsonStreamReader public function handleInput($socket) { if ($this->socket !== $socket) { - throw new Exception('Got input from unexpected socket!'); + // TRANS: Exception thrown when input from an inexpected socket is encountered. + throw new Exception(_m('Got input from unexpected socket!')); } try { @@ -210,7 +212,9 @@ abstract class JsonStreamReader $this->handleLineActive($line); break; default: - throw new Exception('Invalid state in handleLine: ' . $this->state); + // TRANS: Exception thrown when an invalid state is encountered in handleLine. + // TRANS: %s is the invalid state. + throw new Exception(sprintf(_m('Invalid state in handleLine: %s.'),$this->state)); } } @@ -222,15 +226,21 @@ abstract class JsonStreamReader { $bits = explode(' ', $line, 3); if (count($bits) != 3) { - throw new Exception("Invalid HTTP response line: $line"); + // TRANS: Exception thrown when an invalid response line is encountered. + // TRANS: %s is the invalid line. + throw new Exception(sprintf(_m('Invalid HTTP response line: %s.'),$line)); } list($http, $status, $text) = $bits; if (substr($http, 0, 5) != 'HTTP/') { - throw new Exception("Invalid HTTP response line chunk '$http': $line"); + // TRANS: Exception thrown when an invalid response line part is encountered. + // TRANS: %1$s is the chunk, %2$s is the line. + throw new Exception(sprintf(_m('Invalid HTTP response line chunk "%1$s": %2$s.'),$http, $line)); } if ($status != '200') { - throw new Exception("Bad HTTP response code $status: $line"); + // TRANS: Exception thrown when an invalid response code is encountered. + // TRANS: %1$s is the response code, %2$s is the line. + throw new Exception(sprintf(_m('Bad HTTP response code %1$s: %2$s.'),$status,$line)); } common_log(LOG_DEBUG, "$this->id $line"); $this->state = 'headers';