@@ -49,7 +49,7 @@ func (s *Grpc) RegisterAgent(ctx context.Context, req *AgentRequest) (*AuthRespo
4949 agent .AgentKey = key
5050 err = agentService .Create (agent )
5151 if err != nil {
52- catcher .Error ("Failed to create agent" , err , map [ string ] any {} )
52+ catcher .Error ("Failed to create agent" , err , nil )
5353 return nil , err
5454 }
5555
@@ -59,7 +59,7 @@ func (s *Grpc) RegisterAgent(ctx context.Context, req *AgentRequest) (*AuthRespo
5959
6060 err = lastSeenService .Set (key , time .Now ())
6161 if err != nil {
62- catcher .Error ("Failed to set last seen" , err , map [ string ] any {} )
62+ catcher .Error ("Failed to set last seen" , err , nil )
6363 return nil , err
6464 }
6565 res := & AuthResponse {
@@ -89,7 +89,7 @@ func (s *Grpc) UpdateAgent(ctx context.Context, req *AgentRequest) (*AuthRespons
8989
9090 agent , err := agentService .FindByID (uint (id ))
9191 if err != nil {
92- catcher .Error ("Failed to find agent" , err , map [ string ] any {} )
92+ catcher .Error ("Failed to find agent" , err , nil )
9393 return nil , err
9494 }
9595
@@ -120,7 +120,7 @@ func (s *Grpc) UpdateAgent(ctx context.Context, req *AgentRequest) (*AuthRespons
120120
121121 err = agentService .Update (agent )
122122 if err != nil {
123- catcher .Error ("Failed to update agent" , err , map [ string ] any {} )
123+ catcher .Error ("Failed to update agent" , err , nil )
124124 return nil , err
125125 }
126126
@@ -147,7 +147,7 @@ func (s *Grpc) DeleteAgent(ctx context.Context, req *AgentDelete) (*AuthResponse
147147
148148 id , err := agentService .Delete (uuid .MustParse (key ), req .DeletedBy )
149149 if err != nil {
150- catcher .Error ("Unable to delete agent" , err , map [ string ] any {} )
150+ catcher .Error ("Unable to delete agent" , err , nil )
151151 return & AuthResponse {}, status .Error (codes .Internal , fmt .Sprintf ("unable to delete agent: %v" , err .Error ()))
152152 }
153153
@@ -174,7 +174,7 @@ func (s *Grpc) ListAgents(ctx context.Context, req *ListRequest) (*ListAgentsRes
174174
175175 agents , total , err := agentService .ListAgents (page , filter )
176176 if err != nil {
177- catcher .Error ("failed to fetch agents" , err , map [ string ] any {} )
177+ catcher .Error ("failed to fetch agents" , err , nil )
178178 return nil , status .Errorf (codes .Internal , "failed to fetch agents: %v" , err )
179179 }
180180 return convertToAgentResponse (agents , total )
@@ -203,7 +203,7 @@ func (s *Grpc) AgentStream(stream AgentService_AgentStreamServer) error {
203203 delete (s .AgentStreamMap , agentKey )
204204 s .agentStreamMutex .Unlock ()
205205
206- catcher .Error ("failed to reconnect to client" , err , map [ string ] any {} )
206+ catcher .Error ("failed to reconnect to client" , err , nil )
207207 return fmt .Errorf ("failed to reconnect to client: %v" , err )
208208 }
209209
@@ -245,7 +245,7 @@ func (s *Grpc) AgentStream(stream AgentService_AgentStreamServer) error {
245245 },
246246 },
247247 }); err != nil {
248- catcher .Error ("Failed to send result to server" , err , map [ string ] any {} )
248+ catcher .Error ("Failed to send result to server" , err , nil )
249249 }
250250 s .resultChannelM .Lock ()
251251 if resultChan , ok := s .ResultChannel [cmdID ]; ok {
@@ -347,25 +347,25 @@ func (s *Grpc) ProcessCommand(stream PanelService_ProcessCommandServer) error {
347347
348348func (s * Grpc ) UpdateAgentGroup (ctx context.Context , req * AgentGroupUpdate ) (* Agent , error ) {
349349 if req .AgentId == 0 || req .AgentGroup == 0 {
350- catcher .Error ("Error in req" , nil , map [ string ] any {} )
350+ catcher .Error ("Error in req" , nil , nil )
351351 return nil , status .Errorf (codes .FailedPrecondition , "error in req" )
352352 }
353353 agent , err := agentService .UpdateAgentGroup (uint (req .AgentId ), uint (req .AgentGroup ))
354354 if err != nil {
355- catcher .Error ("Unable to update group" , err , map [ string ] any {} )
355+ catcher .Error ("Unable to update group" , err , nil )
356356 return nil , status .Errorf (codes .Internal , "unable to update group: %v" , err )
357357 }
358358 return parseAgentToProto (agent ), nil
359359}
360360
361361func (s * Grpc ) GetAgentByHostname (ctx context.Context , req * Hostname ) (* Agent , error ) {
362362 if req .Hostname == "" {
363- catcher .Error ("Error in req" , nil , map [ string ] any {} )
363+ catcher .Error ("Error in req" , nil , nil )
364364 return nil , status .Errorf (codes .FailedPrecondition , "error in req" )
365365 }
366366 agent , err := agentService .FindByHostname (req .Hostname )
367367 if err != nil {
368- catcher .Error ("Unable to find agent with hostname" , err , map [ string ] any {} )
368+ catcher .Error ("Unable to find agent with hostname" , err , nil )
369369 return nil , status .Errorf (codes .NotFound , "unable to find agent with hostname: %v" , err )
370370 }
371371 return parseAgentToProto (* agent ), nil
@@ -377,7 +377,7 @@ func (s *Grpc) UpdateAgentType(ctx context.Context, req *AgentTypeUpdate) (*Agen
377377 }
378378 agent , err := agentService .UpdateAgentType (uint (req .AgentId ), uint (req .AgentType ))
379379 if err != nil {
380- catcher .Error ("Unable to update type" , err , map [ string ] any {} )
380+ catcher .Error ("Unable to update type" , err , nil )
381381 return nil , status .Errorf (codes .Internal , "unable to update type: %v" , err )
382382 }
383383 return parseAgentToProto (agent ), nil
@@ -388,7 +388,7 @@ func (s *Grpc) LoadAgentCacheFromDatabase() error {
388388 // Fill the agentCache map with agentID and agentToken pairs
389389 agents , err := agentService .FindAll ()
390390 if err != nil {
391- catcher .Error ("Failed to fetch agents from database" , err , map [ string ] any {} )
391+ catcher .Error ("Failed to fetch agents from database" , err , nil )
392392 return err
393393 }
394394 for _ , agent := range agents {
@@ -404,7 +404,7 @@ func (s *Grpc) ListAgentsWithCommands(ctx context.Context, req *ListRequest) (*L
404404
405405 agents , total , err := agentService .ListAgentWithCommands (page , filter )
406406 if err != nil {
407- catcher .Error ("failed to fetch agents" , err , map [ string ] any {} )
407+ catcher .Error ("failed to fetch agents" , err , nil )
408408 return nil , status .Errorf (codes .Internal , "failed to fetch agents: %v" , err )
409409 }
410410
@@ -460,14 +460,14 @@ func createHistoryCommand(cmd *UtmCommand, cmdID string) {
460460 }
461461 err := agentCommandService .Create (cmdHistory )
462462 if err != nil {
463- catcher .Error ("Unable to create a new command history" , err , map [ string ] any {} )
463+ catcher .Error ("Unable to create a new command history" , err , nil )
464464 }
465465}
466466
467467func updateHistoryCommand (cmdResult * CommandResult , cmdID string ) {
468468 err := agentCommandService .UpdateCommandStatusAndResult (findAgentIdByKey (CacheAgent , cmdResult .AgentKey ), cmdID , models .Executed , cmdResult .Result )
469469 if err != nil {
470- catcher .Error ("Failed to update command status" , nil , map [ string ] any {} )
470+ catcher .Error ("Failed to update command status" , nil , nil )
471471 }
472472}
473473
0 commit comments