Skip to content

Commit

Permalink
distsqlpb,importccl: fix a regression in IMPORT
Browse files Browse the repository at this point in the history
This patch ensures that the full error message (pre-unwrap) is
included for errors that flow out of distsql process towards the
gateway.

This is important because some other internal mechanisms inside
CockroachDB are expecting to see the prefixes introduced by
errors.Wrap to decide other things (a bad idea, but not fixable in the
short term), for example see issue cockroachdb#35942.

Release note: None
  • Loading branch information
knz committed Mar 19, 2019
1 parent dbc424a commit dc012bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/sql/distsqlpb/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func NewError(err error) *Error {
// Unwrap the error, to attain the cause.
// Otherwise, Wrap() may hide the roachpb error
// from the cast attempt below.
origErr := err
err = errors.Cause(err)

if pgErr, ok := pgerror.GetPGCause(err); ok {
Expand All @@ -155,7 +156,7 @@ func NewError(err error) *Error {
return &Error{
Detail: &Error_PGError{
PGError: pgerror.NewAssertionErrorf(
"uncaught error: %+v", err)}}
"uncaught error: %+v", origErr)}}
}
}

Expand Down

0 comments on commit dc012bc

Please sign in to comment.