private static function catchError()
    {
        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                self::$error = false;
                break;
            case JSON_ERROR_DEPTH:
                self::$error = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                self::$error = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                self::$error = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                self::$error = 'Syntax error, malformed JSON';
                break;
            case JSON_ERROR_UTF8:
                self::$error = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
            default:
                self::$error = 'Unknown error';
                break;
        }
    }