Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
b0434829
Commit
b0434829
authored
Sep 26, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve view errors.
parent
633c2bde
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
error.php
laravel/error.php
+14
-2
view.php
laravel/view.php
+9
-0
No files found.
laravel/error.php
View file @
b0434829
...
...
@@ -15,6 +15,18 @@ class Error {
ob_get_level
()
and
ob_end_clean
();
$message
=
$exception
->
getMessage
();
// For Laravel view errors we want to show a prettier error:
$file
=
$exception
->
getFile
();
if
(
str_contains
(
$exception
->
getFile
(),
'eval()'
)
and
str_contains
(
$exception
->
getFile
(),
'laravel/view.php'
))
{
$message
=
'Error rendering view: ['
.
View
::
$last
[
'name'
]
.
']'
.
PHP_EOL
.
PHP_EOL
.
$message
;
$file
=
View
::
$last
[
'path'
];
}
// If detailed errors are enabled, we'll just format the exception into
// a simple error message and display it on the screen. We don't use a
// View in case the problem is in the View class.
...
...
@@ -22,9 +34,9 @@ class Error {
{
echo
"<html><h2>Unhandled Exception</h2>
<h3>Message:</h3>
<pre>"
.
$
exception
->
getMessage
()
.
"</pre>
<pre>"
.
$
message
.
"</pre>
<h3>Location:</h3>
<pre>"
.
$
exception
->
getFile
()
.
" on line "
.
$exception
->
getLine
()
.
"</pre>"
;
<pre>"
.
$
file
.
" on line "
.
$exception
->
getLine
()
.
"</pre>"
;
if
(
$trace
)
{
...
...
laravel/view.php
View file @
b0434829
...
...
@@ -44,6 +44,13 @@ class View implements ArrayAccess {
*/
public
static
$cache
=
array
();
/**
* THe last view to be rendered.
*
* @var string
*/
public
static
$last
;
/**
* The Laravel view loader event name.
*
...
...
@@ -387,6 +394,8 @@ class View implements ArrayAccess {
*/
protected
function
load
()
{
static
::
$last
=
array
(
'name'
=>
$this
->
view
,
'path'
=>
$this
->
path
);
if
(
isset
(
static
::
$cache
[
$this
->
path
]))
{
return
static
::
$cache
[
$this
->
path
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment