Changeset 6125


Ignore:
Timestamp:
05/08/12 09:37:45 (12 years ago)
Author:
niltonneto
Message:

Ticket #2507 - Adicionada Exception para tratar erro de mensagem não encontrada.

Location:
sandbox/webservice/api/rest
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sandbox/webservice/api/rest/core/Errors.php

    r6091 r6125  
    3131        const MAIL_NOT_SENT                                     = "1002"; 
    3232        const MAIL_TRASH_NOT_CLEANED            = "1003"; 
     33        const MAIL_MESSAGE_NOT_FOUND            = "1004"; 
    3334         
    3435        static private $reservedErrors = array (                         
     
    5960                self::CATALOG_MIN_ARGUMENT_SEARCH       => "Your search argument must be longer than %1 characters.", 
    6061                self::MAIL_NOT_SENT                                     => "Your mail could not be sent.", 
    61                 self::MAIL_TRASH_NOT_CLEANED            => "Your trash folder could not be cleaned." 
     62                self::MAIL_TRASH_NOT_CLEANED            => "Your trash folder could not be cleaned.", 
     63                self::MAIL_MESSAGE_NOT_FOUND            => "Message not found in folder %1." 
    6264        ); 
    6365                 
  • sandbox/webservice/api/rest/mail/Mail.php

    r6091 r6125  
    9797                                                'msg_number' => $this->getParam('msgID')                                 
    9898                                )); 
     99 
     100                if($info_msg['status_get_msg_info'] == 'false'){ 
     101                        return false; 
     102                } 
    99103                 
    100104                $msg['msgID']    = $info_msg['msg_number']; 
  • sandbox/webservice/api/rest/mail/MessagesResource.php

    r6121 r6125  
    1111                        if($this->getParam('folderID') && $this->getParam('msgID') > 0) { 
    1212                                $msg = $this->getMessage(); 
    13                                 $result = array ('messages' => array($msg)); 
    14                                 $this->setResult($result) ; 
    15                                 return $this->getResponse(); 
     13                                if(!$msg){ 
     14                                        $error = Errors::get(Errors::MAIL_MESSAGE_NOT_FOUND, $this->getParam('folderID')); 
     15                                        throw new ResponseException($error['message'], $error['code']); 
     16                                } 
     17                                else{ 
     18                                        $result = array ('messages' => array($msg)); 
     19                                        $this->setResult($result) ; 
     20                                        return $this->getResponse(); 
     21                                } 
    1622                        } 
    1723         
Note: See TracChangeset for help on using the changeset viewer.