Zend\Stratigility\FinalHandler::createDevelopmentErrorMessage PHP Method

createDevelopmentErrorMessage() private method

Creates an error message with full error details: - If the error is an exception, creates a message that includes the full stack trace. - If the error is an object that defines __toString(), creates a message by casting the error to a string. - If the error is not an object, casts the error to a string. - Otherwise, cerates a generic error message indicating the class type. In all cases, the error message is escaped for use in HTML.
private createDevelopmentErrorMessage ( mixed $error ) : string
$error mixed
return string
    private function createDevelopmentErrorMessage($error)
    {
        if ($error instanceof Exception) {
            $message = $error;
        } elseif (is_object($error) && !method_exists($error, '__toString')) {
            $message = sprintf('Error of type "%s" occurred', get_class($error));
        } else {
            $message = (string) $error;
        }
        $escaper = new Escaper();
        return $escaper->escapeHtml($message);
    }