@@ -174,7 +174,7 @@ func (c *Client) UpdateEnvironment(ctx context.Context) error {
174174 if err != nil {
175175 return c .handleError (& APIError {Err : err })
176176 }
177- if resp .IsError () {
177+ if ! resp .IsSuccess () {
178178 e := & APIError {response : resp .RawResponse }
179179 return c .handleError (e )
180180 }
@@ -187,8 +187,8 @@ func (c *Client) UpdateEnvironment(ctx context.Context) error {
187187// GetIdentitySegments returns the segments that this evaluation context is a part of. It requires a local environment
188188// provided by [WithLocalEvaluation] and/or [WithOfflineEnvironment].
189189func (c * Client ) GetIdentitySegments (ec EvaluationContext ) (s []* segments.SegmentModel , err error ) {
190- env , ok := c .state .GetEnvironment ()
191- if ! ok {
190+ env := c .state .GetEnvironment ()
191+ if env == nil {
192192 return s , errors .New ("GetIdentitySegments called with no local environment available" )
193193 }
194194 identity := c .getIdentityModel (ec .identifier , env .APIKey , ec .traits )
@@ -216,7 +216,7 @@ func (c *Client) BulkIdentify(ctx context.Context, batch []*IdentityTraits) erro
216216 return err
217217 }
218218 if resp .IsError () {
219- return fmt .Errorf ("" )
219+ return fmt .Errorf ("BulkIdentify received response with status %d %s" , resp . StatusCode (), resp . Status () )
220220 }
221221 return nil
222222}
@@ -285,8 +285,8 @@ func (c *Client) getIdentityFlagsFromAPI(ctx context.Context, identifier string,
285285}
286286
287287func (c * Client ) getEnvironmentFlagsFromEnvironment () (Flags , error ) {
288- env , ok := c .state .GetEnvironment ()
289- if ! ok {
288+ env := c .state .GetEnvironment ()
289+ if env == nil {
290290 return Flags {}, fmt .Errorf ("getEnvironmentFlagsFromEnvironment: no local environment is available" )
291291 }
292292 return makeFlagsFromFeatureStates (
@@ -298,8 +298,8 @@ func (c *Client) getEnvironmentFlagsFromEnvironment() (Flags, error) {
298298}
299299
300300func (c * Client ) getIdentityFlagsFromEnvironment (identifier string , traits map [string ]interface {}) (Flags , error ) {
301- env , ok := c .state .GetEnvironment ()
302- if ! ok {
301+ env := c .state .GetEnvironment ()
302+ if env == nil {
303303 return Flags {}, fmt .Errorf ("getIdentityFlagsFromDocument: no local environment is available" )
304304 }
305305 identity := c .getIdentityModel (identifier , env .APIKey , traits )
0 commit comments