Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
495033b9
authored
2013-12-13 21:25:25 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix #366
1 parent
9c164408
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
router.go
router.go
View file @
495033b
...
...
@@ -369,15 +369,30 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if
_
,
ok
:=
err
.
(
middleware
.
HTTPException
);
ok
{
// catch intented errors, only for HTTP 4XX and 5XX
}
else
{
if
RunMode
==
"dev"
{
if
!
RecoverPanic
{
panic
(
err
)
}
else
{
var
stack
string
Critical
(
"Handler crashed with error"
,
err
)
for
i
:=
1
;
;
i
++
{
_
,
file
,
line
,
ok
:=
runtime
.
Caller
(
i
)
if
!
ok
{
break
}
Critical
(
file
,
line
)
stack
=
stack
+
fmt
.
Sprintln
(
file
,
line
)
}
middleware
.
ShowErr
(
err
,
rw
,
r
,
stack
)
}
}
else
{
if
ErrorsShow
{
handler
:=
p
.
getErrorHandler
(
fmt
.
Sprint
(
err
))
handler
(
rw
,
r
)
}
else
{
if
!
RecoverPanic
{
// go back to panic
panic
(
err
)
}
else
{
var
stack
string
Critical
(
"Handler crashed with error"
,
err
)
for
i
:=
1
;
;
i
++
{
_
,
file
,
line
,
ok
:=
runtime
.
Caller
(
i
)
...
...
@@ -385,15 +400,11 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
break
}
Critical
(
file
,
line
)
if
RunMode
==
"dev"
{
stack
=
stack
+
fmt
.
Sprintln
(
file
,
line
)
}
}
if
RunMode
==
"dev"
{
middleware
.
ShowErr
(
err
,
rw
,
r
,
stack
)
}
}
}
}
}
}()
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment