Different error message in espocloud and local EspoCRM

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vincent
    Senior Member
    • May 2017
    • 176

    Different error message in espocloud and local EspoCRM

    I have added a formula for setting the value to a field of an entity and found that the error message is different in espocloud and local EspoCRM (both are 4.8.4)

    Message in espocloud : Error 500: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'xxxxxxx' for column 'yyyy' at row 1
    Message in local EspoCRM: Error 500

    It seems that mesage in error mesage in espocloud provides more details

    How can i config the local EspoCRM to have the same behavior as espocloud.

    Thanks.
    Last edited by Vincent; 01-03-2018, 06:08 AM.
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    Could you share your formula?

    Comment

    • Vincent
      Senior Member
      • May 2017
      • 176

      #3
      hi,

      below is the formula
      ifThen(version == null, valid = 'missing version');

      I want may local espoCRM have the same behavior as espocloud showing error message with more details, how can i do this?

      Thanks.

      Comment

      • Vincent
        Senior Member
        • May 2017
        • 176

        #4
        Attached please find the error shown in espocloud, how can i config the espocrm to have the error message with details (like message in attachment) instead of message with error number only (e.g. Error 500).

        Thanks.
        Attached Files

        Comment

        • tanya
          Senior Member
          • Jun 2014
          • 4308

          #5
          According to error text, version is an integer value, but you try to assign a text. Am I right?

          Comment

          • Vincent
            Senior Member
            • May 2017
            • 176

            #6
            Yes, you are right. This is the example showing that error message in espocloud is more informative. In my local espocrm, it shows "Error 500" and i want my local espocrm behaving like espocloud. What can i do? Thanks.

            Comment

            • Vincent
              Senior Member
              • May 2017
              • 176

              #7
              Is there anything i can do to make the message showing the error detail, not just the error code? Thanks.

              Comment

              • tanya
                Senior Member
                • Jun 2014
                • 4308

                #8
                It seems you have to configure error reporting on your server

                Comment

                • Vincent
                  Senior Member
                  • May 2017
                  • 176

                  #9
                  hi, I have compared the response header of response from espocloud and my local espocrm, i found the difference!

                  There is a X-Status-Reason header containing the error message in the response from espocloud, but no that header from my local espocrm.

                  Comment

                  • Vincent
                    Senior Member
                    • May 2017
                    • 176

                    #10
                    I found that the $statusCode passed in displayError function in Output.php is not 500, but HY000 in my local espocrm (using IIS)
                    It seems that passing HY000 to status function makes the error message disappear.

                    I updated the function as below and error message can be shown on the screen

                    PHP Code:
                    public function displayError($text, $statusCode = 500, $isPrint = false)
                        {
                            $GLOBALS['log']->error('Display Error: '.$text.', Code: '.$statusCode.' URL: '.$_SERVER['REQUEST_URI']);
                    
                            ob_clean();
                    
                            if (!empty( $this->slim)) {
                    
                            if (is_numeric ($statusCode))
                                {                
                                    $this->getSlim()->response()->status($statusCode);
                                }
                                else
                                {
                                   $this->getSlim()->response()->status('500');
                                }
                                  $this->getSlim()->response()->header('X-Status-Reason', $text);
                    
                                if ($isPrint) {
                                    $status = $this->getCodeDesc($statusCode);
                                    $status = isset($status) ? $statusCode.' '.$status : 'HTTP '.$statusCode;
                                    $this->getSlim()->printError($text, $status);
                                }
                    
                                $this->getSlim()->stop();
                            } else {
                                $GLOBALS['log']->info('Could not get Slim instance. It looks like a direct call (bypass API). URL: '.$_SERVER['REQUEST_URI']);
                                die($text);
                            }
                        } 
                    
                    Last edited by Vincent; 01-19-2018, 09:19 AM.

                    Comment

                    Working...