[GODRIVER-2694] Return errors from "description.NewServer" and "fsm.apply" Created: 15/Dec/22  Updated: 08/Jan/24

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to GODRIVER-2965 Make the "description" package internal Blocked
is related to GODRIVER-2691 Deprecate "description.Server" fields... Closed
Epic Link: Go Driver 2.0: Driver

 Description   

The description.NewServer and fsm.apply functions create or modify server descriptions. Both of those functions set any errors that happen on the returned or modified description.Server struct instead of returning it as part of the function signature. That deviates from typical Go function signatures and can lead to bugs if someone doesn't realize they need to check the LastError field on the returned struct. Update both functions to return errors as well as set the error in the LastError field. Update calling code to check the returned error instead of the error on the description.Server

Definition of done:

  • Update description.NewServer and fsm.apply to return an error.
  • Update all calling code to check the returned error instead of the description.Server.LastError field.

Generated at Thu Feb 08 08:39:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.