-
Notifications
You must be signed in to change notification settings - Fork 11.4k
View exception handling fix (discussion) #7965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -390,14 +390,18 @@ public function __call($method, $parameters) | |
throw new BadMethodCallException("Method [$method] does not exist on view."); | ||
} | ||
|
||
/** | ||
* Get the string contents of the view. | ||
* | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->render(); | ||
} | ||
/** | ||
* Get the string contents of the view. | ||
* | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
try { | ||
return $this->render(); | ||
} catch (\Exception $e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please import this. |
||
return $e->getMessage(); | ||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,14 @@ public function testWithErrors() | |
} | ||
|
||
|
||
public function testViewExceptionHandling() | ||
9822
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please indent with tabs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No offense - but will worry about that once I know what sort of solution I should be going with :) |
||
{ | ||
$view = $this->getView(); | ||
|
||
$this->assertEquals('Method Mockery_0_Illuminate_View_Factory::incrementRender() does not exist on this mock object', (string) $view); | ||
} | ||
|
||
|
||
protected function getView() | ||
{ | ||
return new View( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please indent with tabs.