Skip to content

Commit

Permalink
fix incorrect error sending (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
mansapabbaraju authored and rajsigma committed Aug 29, 2023
1 parent 4619ddd commit cec8eca
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ func (sc *snowflakeConn) blockOnRunningQuery(
if err != nil {
return err
}
return (&SnowflakeError{
Number: code,
SQLState: resp.Data.SQLState,
Message: err.Error(),
QueryID: resp.Data.QueryID,
}).exceptionTelemetry(sc)
}
if code == -1 {
ok, deadline := ctx.Deadline()
Expand All @@ -446,12 +452,6 @@ func (sc *snowflakeConn) blockOnRunningQuery(
logger.WithContext(ctx).Errorf("sullSnowflakeRestful")
}
}
return (&SnowflakeError{
Number: code,
SQLState: resp.Data.SQLState,
Message: err.Error(),
QueryID: resp.Data.QueryID,
}).exceptionTelemetry(sc)
}
return err
}
Expand All @@ -464,6 +464,12 @@ func (sc *snowflakeConn) blockOnRunningQuery(
code = ErrQueryStatus
message = fmt.Sprintf("%s: (failed to parse original code: %s: %s)", message, resp.Code, err.Error())
}
return (&SnowflakeError{
Number: code,
SQLState: resp.Data.SQLState,
Message: message,
QueryID: resp.Data.QueryID,
}).exceptionTelemetry(sc)
}
if code == -1 {
ok, deadline := ctx.Deadline()
Expand All @@ -473,12 +479,6 @@ func (sc *snowflakeConn) blockOnRunningQuery(
logger.WithContext(ctx).Errorf("sullSnowflakeRestful")
}
}
return (&SnowflakeError{
Number: code,
SQLState: resp.Data.SQLState,
Message: message,
QueryID: resp.Data.QueryID,
}).exceptionTelemetry(sc)
}
return nil
}
Expand Down

0 comments on commit cec8eca

Please sign in to comment.