TrackCommandError records a command eventerror, send telemetry synchronously to ensure it is sent before the process exits after error do nothing if err == nil
(ctx context.Context, action string, args []string, err error)
| 24 | // TrackCommandError records a command eventerror, send telemetry synchronously to ensure it is sent before the process exits after error |
| 25 | // do nothing if err == nil |
| 26 | func TrackCommandError(ctx context.Context, action string, args []string, err error) { |
| 27 | if err == nil { |
| 28 | return |
| 29 | } |
| 30 | EnsureGlobalTelemetryInitialized(ctx) |
| 31 | |
| 32 | if globalToolTelemetryClient != nil { |
| 33 | commandEvent := CommandEvent{ |
| 34 | Action: action, |
| 35 | Args: args, |
| 36 | Error: err.Error(), |
| 37 | Success: false, |
| 38 | } |
| 39 | globalToolTelemetryClient.TrackSynchronous(ctx, &commandEvent) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // Global variables for simple tool telemetry |
| 44 | var ( |
no test coverage detected