Skip to content

Commit

Permalink
Changes: Add service-center error codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
little-cui committed Nov 17, 2017
1 parent 0ba71f5 commit 4d981a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/handler/auth/handler.go
Expand Up @@ -17,7 +17,9 @@ import (
"github.com/ServiceComb/service-center/pkg/chain"
"github.com/ServiceComb/service-center/pkg/rest"
"github.com/ServiceComb/service-center/pkg/util"
scerr "github.com/ServiceComb/service-center/server/error"
"github.com/ServiceComb/service-center/server/plugin/dynamic"
"github.com/ServiceComb/service-center/server/rest/controller"
"net/http"
)

Expand All @@ -35,7 +37,8 @@ func (h *AuthRequest) Handle(i *chain.Invocation) {
util.Logger().Errorf(err, "authenticate request failed, %s %s", r.Method, r.RequestURI)

w := i.Context().Value(rest.CTX_RESPONSE).(http.ResponseWriter)
http.Error(w, "Request Unauthorized", http.StatusUnauthorized)
controller.WriteError(w, scerr.ErrUnauthorized, err.Error())

i.Fail(nil)
}

Expand Down

0 comments on commit 4d981a9

Please sign in to comment.