Skip to content

Commit

Permalink
Merge pull request #268 from mickeyreiss/fix-call-error-context
Browse files Browse the repository at this point in the history
Update context from callError
  • Loading branch information
marioizquierdo authored Sep 13, 2020
2 parents 551952a + 14a1a2a commit db097af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions protoc-gen-twirp/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ func (t *twirp) generateServerJSONMethod(service *descriptor.ServiceDescriptorPr
t.P(` if n, err := resp.Write(respBytes); err != nil {`)
t.P(` msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())`)
t.P(` twerr := `, t.pkgs["twirp"], `.NewError(`, t.pkgs["twirp"], `.Unknown, msg)`)
t.P(` callError(ctx, s.hooks, twerr)`)
t.P(` ctx = callError(ctx, s.hooks, twerr)`)
t.P(` }`)
t.P(` callResponseSent(ctx, s.hooks)`)
t.P(`}`)
Expand Down Expand Up @@ -1303,7 +1303,7 @@ func (t *twirp) generateServerProtobufMethod(service *descriptor.ServiceDescript
t.P(` if n, err := resp.Write(respBytes); err != nil {`)
t.P(` msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())`)
t.P(` twerr := `, t.pkgs["twirp"], `.NewError(`, t.pkgs["twirp"], `.Unknown, msg)`)
t.P(` callError(ctx, s.hooks, twerr)`)
t.P(` ctx = callError(ctx, s.hooks, twerr)`)
t.P(` }`)
t.P(` callResponseSent(ctx, s.hooks)`)
t.P(`}`)
Expand Down

0 comments on commit db097af

Please sign in to comment.