source: sandbox/webservice/api/library/Errors.php @ 5954

Revision 5954, 2.3 KB checked in by niltonneto, 12 years ago (diff)

Ticket #2507 - Corrigido método getUserId(). Renomeado classe http_request.

Line 
1<?php
2
3class Errors {
4               
5        // Errors from -32000 to -32099 => Server error :Reserved for implementation-defined server-errors.
6        const E_PARSE_ERROR             = "-32700";     
7        const E_INVALID_REQUEST         = "-32600";
8        const E_METHOD_NOT_FOUND        = "-32601";
9        const E_INVALID_PARAMS          = "-32602";
10        const E_INTERNAL_ERROR          = "-32603";     
11
12        // Errors inherited from Expresso Application. 
13        const LOGIN_SUCCESS_LOGOUT                      = "1";
14        const LOGIN_SESSION_EXPIRED             = "2";
15        const LOGIN_NOT_LOGGED_IN                       = "3";
16        const LOGIN_COOKIES_REQUIRED            = "4";
17        const LOGIN_BADLOGIN                            = "5";
18        const LOGIN_PASSWORD_EXPIRED            = "6";
19        const LOGIN_AUTH_INVALID                        = "7";
20        const LOGIN_SESSION_NOT_VERIFIED        = "10";
21        const LOGIN_ACCOUNT_EXPIRED             = "98";
22        const LOGIN_LOGIN_BLOCKED                       = "99";
23        const LOGIN_INVALID_LOGIN                       = "200";
24
25        const CATALOG_MIN_ARGUMENT_SEARCH       = "1001";       
26       
27        static private $reservedErrors = array (                       
28                self::E_PARSE_ERROR             => "Parse error",
29                self::E_INVALID_REQUEST         => "Invalid Request",
30                self::E_METHOD_NOT_FOUND        => "Method not found",
31                self::E_INVALID_PARAMS          => "Invalid params",
32                self::E_INTERNAL_ERROR          => "Internal error"     
33        );
34       
35       
36        // Errors inherited from Expresso Application.
37        static private $applicationErrors = array(                     
38
39                self::LOGIN_SUCCESS_LOGOUT                      => "You have been successfully logged out",
40                self::LOGIN_SESSION_EXPIRED             => "Sorry, your login has expired",
41                self::LOGIN_NOT_LOGGED_IN                       => "You are not logged in",
42                self::LOGIN_COOKIES_REQUIRED            => "Cookies are required to login to this site.",
43                self::LOGIN_BADLOGIN                            => "bad login or password",
44                self::LOGIN_PASSWORD_EXPIRED            => "Your password has expired, and you do not have access to change it",
45                self::LOGIN_AUTH_INVALID                        => "Your auth is invalid",
46                self::LOGIN_SESSION_NOT_VERIFIED        => "Your session could not be verified.",
47                self::LOGIN_ACCOUNT_EXPIRED             => "Account is expired",
48                self::LOGIN_LOGIN_BLOCKED                       => "Blocked, too many attempts!",
49                self::LOGIN_INVALID_LOGIN                       => "Bad login or password",
50                self::CATALOG_MIN_ARGUMENT_SEARCH       => "Your search argument must be longer than %1 characters."
51                       
52                       
53        );
54               
55        static public function get($code, $jsonrpc = "2.0"){
56                               
57                $errors = self::$reservedErrors + self::$applicationErrors;
58                if($jsonrpc == "2.0")
59                        return array ("code" => $code, "message" => $errors[$code]);           
60                else
61                        return $errors[$code];
62        }                       
63               
64}
Note: See TracBrowser for help on using the repository browser.