@@ -117,7 +117,7 @@ func (client *PortainerEdgeClient) GetEnvironmentID() (portainer.EndpointID, err
117117 defer resp .Body .Close ()
118118
119119 if resp .StatusCode != http .StatusOK {
120- return 0 , logPollingError (resp , "global key request failed" )
120+ return 0 , logPollingError (resp , "EdgeAgentGetEnvironmentID" , fmt . Sprintf ( "EdgeAgent [%d] failed to request global key" , client . getEndpointIDFn ()) )
121121 }
122122
123123 var responseData globalKeyResponse
@@ -160,7 +160,7 @@ func (client *PortainerEdgeClient) GetEnvironmentStatus(flags ...string) (*PollS
160160 }
161161
162162 if resp .StatusCode != http .StatusOK {
163- return nil , logPollingError (resp , "short poll request failed" )
163+ return nil , logPollingError (resp , "EdgeAgentGetEnvironmentStatus" , fmt . Sprintf ( "EdgeAgent [%d] failed to request edge environment status" , client . getEndpointIDFn ()) )
164164 }
165165
166166 var responseData PollStatusResponse
@@ -195,7 +195,7 @@ func (client *PortainerEdgeClient) GetEdgeStackConfig(edgeStackID int, version *
195195 defer resp .Body .Close ()
196196
197197 if resp .StatusCode != http .StatusOK {
198- return nil , logPollingError (resp , "GetEdgeStackConfig operation failed" )
198+ return nil , logPollingError (resp , "EdgeAgentGetEdgeStackConfig" , fmt . Sprintf ( "EdgeAgent [%d] failed to request edge stack config" , client . getEndpointIDFn ()) )
199199 }
200200
201201 var data edge.StackPayload
@@ -250,7 +250,7 @@ func (client *PortainerEdgeClient) SetEdgeStackStatus(
250250 resp .Body .Close ()
251251
252252 if resp .StatusCode != http .StatusOK {
253- return logPollingError (resp , "SetEdgeStackStatus operation failed" )
253+ return logPollingError (resp , "EdgeAgentSetEdgeStackStatus" , fmt . Sprintf ( "EdgeAgent [%d] failed to set edge stack status" , client . getEndpointIDFn ()) )
254254 }
255255
256256 return nil
@@ -285,7 +285,7 @@ func (client *PortainerEdgeClient) SetEdgeJobStatus(edgeJobStatus agent.EdgeJobS
285285 resp .Body .Close ()
286286
287287 if resp .StatusCode != http .StatusOK {
288- return logPollingError (resp , "SetEdgeJobStatus operation failed" )
288+ return logPollingError (resp , "EdgeAgentSetEdgeJobStatus" , fmt . Sprintf ( "EdgeAgent [%d] failed to set edge job status" , client . getEndpointIDFn ()) )
289289 }
290290
291291 return nil
@@ -308,10 +308,10 @@ func (client *PortainerEdgeClient) GetEdgeConfig(id EdgeConfigID) (*EdgeConfig,
308308
309309 if resp .StatusCode != http .StatusOK {
310310 if resp .StatusCode == http .StatusForbidden {
311- return nil , logPollingError (resp , "GetEdgeConfig operation forbidden" )
311+ return nil , logPollingError (resp , "EdgeAgentGetEdgeConfig" , fmt . Sprintf ( "EdgeAgent [%d] is forbidden to get the info of edge config [%d]" , client . getEndpointIDFn (), id ) )
312312 }
313313
314- return nil , logPollingError (resp , "GetEdgeConfig operation failed" )
314+ return nil , logPollingError (resp , "EdgeAgentGetEdgeConfig" , fmt . Sprintf ( "EdgeAgent [%d] failed to get the info of edge config [%d]" , client . getEndpointIDFn (), id ) )
315315 }
316316
317317 var data EdgeConfig
@@ -341,7 +341,7 @@ func (client *PortainerEdgeClient) SetEdgeConfigState(id EdgeConfigID, state Edg
341341 resp .Body .Close ()
342342
343343 if resp .StatusCode != http .StatusOK {
344- return logPollingError (resp , fmt .Sprintf ("edge_config_id: %d, state: %s, error: %s " , id , state , "SetEdgeConfigState operation failed" ))
344+ return logPollingError (resp , "EdgeAgentSetEdgeConfigState" , fmt .Sprintf ("EdgeAgent [%d] failed to set the state [%s] to edge config [%d] " , client . getEndpointIDFn () , state , id ))
345345 }
346346
347347 return nil
0 commit comments