mxmbsocket/lib/Ratchet/Application/WAMP/JSONException.php
Chris Boden c56ba3b2f1 Init WAMP
Starting work on the WebSocket Application Messaging Protocol (WAMP).
JSON messages, supports pub/sub and RPC via HTTP endpoints for website integration
2011-12-18 15:32:11 -05:00

31 lines
916 B
PHP

<?php
namespace Ratchet\Application\WAMP;
class JSONException extends \Exception {
public function __construct() {
$code = json_last_error();
switch ($code) {
case JSON_ERROR_DEPTH:
$msg = 'Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$msg = 'Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
$msg = 'Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
$msg = 'Syntax error, malformed JSON';
break;
case JSON_ERROR_UTF8:
$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
$msg = 'Unknown error';
break;
}
parent::__construct($msg, $code);
}
}