@@ -176,7 +176,7 @@ func newEtcdClient(ctx context.Context, etcdClient etcd, callTimeout time.Durati
176176 return nil , errors .New ("etcd client was not configured with any endpoints" )
177177 }
178178
179- ctx , cancel := context .WithTimeout (ctx , callTimeout )
179+ ctx , cancel := context .WithTimeoutCause (ctx , callTimeout , errors . New ( "call timeout expired" ) )
180180 defer cancel ()
181181
182182 status , err := etcdClient .Status (ctx , endpoints [0 ])
@@ -200,7 +200,7 @@ func (c *Client) Close() error {
200200
201201// Members retrieves a list of etcd members.
202202func (c * Client ) Members (ctx context.Context ) ([]* Member , error ) {
203- ctx , cancel := context .WithTimeout (ctx , c .CallTimeout )
203+ ctx , cancel := context .WithTimeoutCause (ctx , c .CallTimeout , errors . New ( "call timeout expired" ) )
204204 defer cancel ()
205205
206206 response , err := c .EtcdClient .MemberList (ctx )
@@ -231,7 +231,7 @@ func (c *Client) Members(ctx context.Context) ([]*Member, error) {
231231
232232// MoveLeader moves the leader to the provided member ID.
233233func (c * Client ) MoveLeader (ctx context.Context , newLeaderID uint64 ) error {
234- ctx , cancel := context .WithTimeout (ctx , c .CallTimeout )
234+ ctx , cancel := context .WithTimeoutCause (ctx , c .CallTimeout , errors . New ( "call timeout expired" ) )
235235 defer cancel ()
236236
237237 _ , err := c .EtcdClient .MoveLeader (ctx , newLeaderID )
@@ -240,7 +240,7 @@ func (c *Client) MoveLeader(ctx context.Context, newLeaderID uint64) error {
240240
241241// RemoveMember removes a given member.
242242func (c * Client ) RemoveMember (ctx context.Context , id uint64 ) error {
243- ctx , cancel := context .WithTimeout (ctx , c .CallTimeout )
243+ ctx , cancel := context .WithTimeoutCause (ctx , c .CallTimeout , errors . New ( "call timeout expired" ) )
244244 defer cancel ()
245245
246246 _ , err := c .EtcdClient .MemberRemove (ctx , id )
@@ -249,7 +249,7 @@ func (c *Client) RemoveMember(ctx context.Context, id uint64) error {
249249
250250// UpdateMemberPeerURLs updates the list of peer URLs.
251251func (c * Client ) UpdateMemberPeerURLs (ctx context.Context , id uint64 , peerURLs []string ) ([]* Member , error ) {
252- ctx , cancel := context .WithTimeout (ctx , c .CallTimeout )
252+ ctx , cancel := context .WithTimeoutCause (ctx , c .CallTimeout , errors . New ( "call timeout expired" ) )
253253 defer cancel ()
254254
255255 response , err := c .EtcdClient .MemberUpdate (ctx , id , peerURLs )
@@ -267,7 +267,7 @@ func (c *Client) UpdateMemberPeerURLs(ctx context.Context, id uint64, peerURLs [
267267
268268// Alarms retrieves all alarms on a cluster.
269269func (c * Client ) Alarms (ctx context.Context ) ([]MemberAlarm , error ) {
270- ctx , cancel := context .WithTimeout (ctx , c .CallTimeout )
270+ ctx , cancel := context .WithTimeoutCause (ctx , c .CallTimeout , errors . New ( "call timeout expired" ) )
271271 defer cancel ()
272272
273273 alarmResponse , err := c .EtcdClient .AlarmList (ctx )
0 commit comments