Fix error handling in renderStatic #64
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue-60"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In
renderStatic,modTimeshould be set to the file's mod time if it exists. If the file does not exist,renderStaticshouldmodTimeuninitialized,404 Not Founderror.Fixes #60.
@ -58,3 +58,3 @@rootURL: rootURL,}return CreateMainRouter(&rl), &rlreturn CreateMainRouter(&rl, true), &rl(see comment below on the use of
debugas a function parameter)@ -40,6 +41,7 @@ func (rl *rushlink) recoveryMiddleware(next http.Handler) http.Handler {}()if err := recover(); err != nil {w.WriteHeader(500)Can we definitively state that
panic()s are caused due to errors on the server side?Yes.
panics during runtime should always indicate a bug.@ -81,3 +83,3 @@// CreateMainRouter creates the main Gorilla router for the application.func CreateMainRouter(rl *rushlink) *mux.Router {func CreateMainRouter(rl *rushlink, debug bool) *mux.Router {Instead of adding a debug parameter here, would it make sense to set
router.Use(rl.recoveryMiddleware)insideTestIssue60?And, if we want debugging options, this should be a globally configurable option, instead of a function parameter.
So you mean, as a global variable? So in this case,
debugdescribes that the panic recovery middleware should be disabled, because otherwise we cannot run the tests. We could also change the namedebugtonoPanicMiddleware.What kind of solution would be good here?
@ -120,3 +124,3 @@srv := &http.Server{Handler: CreateMainRouter(&rl),Handler: CreateMainRouter(&rl, false),(see comment above on the use of
debugas a function parameter)