Improved error handling
This commit is contained in:
@ -24,7 +24,11 @@ func TestRouter(t *testing.T) {
|
||||
})
|
||||
|
||||
s.Get("/error", func(ctx server.Context) error {
|
||||
return ctx.Error(http.StatusUnauthorized, errors.New("Not logged in"))
|
||||
return ctx.Error(http.StatusUnauthorized, "Not logged in")
|
||||
})
|
||||
|
||||
s.Get("/error2", func(ctx server.Context) error {
|
||||
return ctx.Error(http.StatusUnauthorized, "Not logged in", errors.New("Missing auth token"))
|
||||
})
|
||||
|
||||
s.Get("/reader", func(ctx server.Context) error {
|
||||
@ -43,6 +47,7 @@ func TestRouter(t *testing.T) {
|
||||
{URL: "/", Status: http.StatusOK, Body: "Hello"},
|
||||
{URL: "/blog/post", Status: http.StatusOK, Body: "Hello"},
|
||||
{URL: "/error", Status: http.StatusUnauthorized, Body: "Not logged in"},
|
||||
{URL: "/error2", Status: http.StatusUnauthorized, Body: "Not logged in\nMissing auth token"},
|
||||
{URL: "/not-found", Status: http.StatusNotFound, Body: http.StatusText(http.StatusNotFound)},
|
||||
{URL: "/reader", Status: http.StatusOK, Body: "Hello"},
|
||||
{URL: "/string", Status: http.StatusOK, Body: "Hello"},
|
||||
|
Reference in New Issue
Block a user