Development

Changeset 5291

You must first sign up to be able to contribute.

Changeset 5291

Show
Ignore:
Timestamp:
09/26/07 17:51:32 (2 years ago)
Author:
fabien
Message:

display the wrapped exception stack trace when displaying an exception

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/exception/sfException.class.php

    r5139 r5291  
    2323class sfException extends Exception 
    2424{ 
     25  protected 
     26    $wrappedException = null; 
     27 
    2528  /** 
    2629   * Wraps an Exception. 
     
    3235  static public function createFromException(Exception $e) 
    3336  { 
    34     return new sfException(sprintf('Wrapped %s: %s', get_class($e), $e->getMessage())); 
     37    $exception = new sfException(sprintf('Wrapped %s: %s', get_class($e), $e->getMessage())); 
     38    $exception->setWrappedException($e); 
     39 
     40    return $exception; 
     41  } 
     42 
     43  public function setWrappedException($e) 
     44  { 
     45    $this->wrappedException = $e; 
    3546  } 
    3647 
     
    98109    $name    = get_class($this); 
    99110    $format  = 0 == strncasecmp(PHP_SAPI, 'cli', 3) ? 'plain' : 'html'; 
    100     $traces  = self::getTraces($this, $format); 
     111    $traces  = self::getTraces(is_null($this->wrappedException) ? $this : $this->wrappedException, $format); 
    101112 
    102113    // dump main objects values 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.