Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
71afdfee
Commit
71afdfee
authored
Jun 18, 2019
by
Francisco Javier López
Committed by
Nick Thomas
Jun 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor error logging helpers
parent
9023f0b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
internal/helper/helpers.go
internal/helper/helpers.go
+7
-13
No files found.
internal/helper/helpers.go
View file @
71afdfee
...
...
@@ -21,8 +21,7 @@ import (
const
NginxResponseBufferHeader
=
"X-Accel-Buffering"
func
Fail500
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
err
error
)
{
http
.
Error
(
w
,
"Internal server error"
,
500
)
func
LogError
(
r
*
http
.
Request
,
err
error
)
{
if
err
!=
nil
{
captureRavenError
(
r
,
err
)
}
...
...
@@ -30,24 +29,19 @@ func Fail500(w http.ResponseWriter, r *http.Request, err error) {
printError
(
r
,
err
)
}
func
LogError
(
r
*
http
.
Request
,
err
error
)
{
if
err
!=
nil
{
captureRaven
Error
(
r
,
err
)
}
func
CaptureAndFail
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
err
error
,
msg
string
,
code
int
)
{
http
.
Error
(
w
,
msg
,
code
)
Log
Error
(
r
,
err
)
}
printError
(
r
,
err
)
func
Fail500
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
err
error
)
{
CaptureAndFail
(
w
,
r
,
err
,
"Internal server error"
,
http
.
StatusInternalServerError
)
}
func
RequestEntityTooLarge
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
err
error
)
{
CaptureAndFail
(
w
,
r
,
err
,
"Request Entity Too Large"
,
http
.
StatusRequestEntityTooLarge
)
}
func
CaptureAndFail
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
err
error
,
msg
string
,
code
int
)
{
http
.
Error
(
w
,
msg
,
code
)
captureRavenError
(
r
,
err
)
printError
(
r
,
err
)
}
func
printError
(
r
*
http
.
Request
,
err
error
)
{
if
r
!=
nil
{
log
.
WithFields
(
r
.
Context
(),
log
.
Fields
{
...
...
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