From 756881cf14c1f7a5403fcd3075b04aad8166dfdc Mon Sep 17 00:00:00 2001 From: some Date: Wed, 9 Oct 2024 13:12:31 -0400 Subject: [PATCH] Add ErrorHandler to UnimplementedServers --- server/callback.go | 8 +++++--- server/token.go | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/callback.go b/server/callback.go index 2e14dfd..b9ff325 100644 --- a/server/callback.go +++ b/server/callback.go @@ -47,12 +47,14 @@ func (r CallbackResponse) Response() router.Response { return &r } -type UnimplementedCallbackServer struct{} +type UnimplementedCallbackServer struct { + *ErrorHandler +} func (UnimplementedCallbackServer) mustEmbedUnimplementedCallbackServer() {} -func (UnimplementedCallbackServer) Callback(req *CallbackRequestBuilder) (res *CallbackResponse, errRes router.ErrorResponse) { - errRes = &ErrorHandler{router.DefaultErrorNotImplemented} +func (u UnimplementedCallbackServer) Callback(req *CallbackRequestBuilder) (res *CallbackResponse, errRes router.ErrorResponse) { + errRes = u.ErrorResponse(router.DefaultErrorNotImplemented) return } diff --git a/server/token.go b/server/token.go index 0e7bf28..8213648 100644 --- a/server/token.go +++ b/server/token.go @@ -52,12 +52,14 @@ func (r TokenResponse) Response() router.Response { return &r } -type UnimplementedTokenServer struct{} +type UnimplementedTokenServer struct { + *ErrorHandler +} func (UnimplementedTokenServer) mustEmbedUnimplementedTokenServer() {} -func (UnimplementedTokenServer) Token(req *TokenRequestBuilder) (res *TokenResponse, errRes router.ErrorResponse) { - errRes = &ErrorHandler{router.DefaultErrorNotImplemented} +func (u UnimplementedTokenServer) Token(req *TokenRequestBuilder) (res *TokenResponse, errRes router.ErrorResponse) { + errRes = u.ErrorResponse(router.DefaultErrorNotImplemented) return }