Skip to content

Commit

Permalink
#73 ignore specific error
Browse files Browse the repository at this point in the history
  • Loading branch information
Reindert Vetter committed Oct 31, 2020
1 parent 661319c commit 3b14834
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
15 changes: 12 additions & 3 deletions app/report/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ import (
)

/**
* Below you will find a list of all user errors. By default these errors are not logged by config `config.Errors.NoLogging`.
* Below you will find a list of all user errors. By default these errors
* are not logged by config `config.Errors.NoLogging`. These errors are
* usually errors with http status 499 and lower.
*/
var UserError = errors.New("").Status(net.StatusBadRequest).Level(log_level.INFO)
var PageNotFound = UserError.Wrap("page not found").Status(net.StatusNotFound)
var ValidationError = UserError.Status(net.StatusNotFound)
var NotFoundError = UserError.Status(net.StatusNotFound)
var PageNotFoundError = UserError.Wrap("page not found")

var SystemError = errors.New("").Status(net.StatusInternalServerError)
/**
* This list contains errors that indicate that the system is not working
* properly. The message is not displayed to the user on a production environment,
* but will be logged (if MinLevel of the logger allows it).
*/
var SystemError = errors.New("").Status(net.StatusInternalServerError).Level(log_level.EMERGENCY)
11 changes: 8 additions & 3 deletions config/errors.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package config

import "lanvard/app/report"
import (
"github.com/lanvard/routing"
"lanvard/app/report"
)

var Errors = struct {
NoLogging []error
}{

/*
|--------------------------------------------------------------------------
| No Logging
Expand All @@ -15,6 +17,9 @@ var Errors = struct {
|
*/
NoLogging: []error{
report.UserError,
routing.MethodNotAllowedError,
routing.RouteNotFoundError,
report.ValidationError,
report.NotFoundError,
},
}
2 changes: 1 addition & 1 deletion src/controller/homepage.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
)

func Homepage(request inter.Request) inter.Response {
return outcome.Html(report.PageNotFound)
return outcome.Html(report.PageNotFoundError)
}

0 comments on commit 3b14834

Please sign in to comment.