(ctx Context)
| 26 | } |
| 27 | |
| 28 | func (e *errorsPushCommand) Run(ctx Context) error { |
| 29 | client, err := ctx.clientFactory.getClient() |
| 30 | if err != nil { |
| 31 | return err |
| 32 | } |
| 33 | errStr := e.ErrorMessage |
| 34 | response, err := client.Post("system/error", strings.TrimSpace(errStr)) |
| 35 | if err != nil { |
| 36 | return err |
| 37 | } |
| 38 | if response.StatusCode != http.StatusOK { |
| 39 | errStr = fmt.Sprint("Failed to push error\nStatus code: ", response.StatusCode) |
| 40 | bytes, err := responseToBArray(response) |
| 41 | if err != nil { |
| 42 | return err |
| 43 | } |
| 44 | body := string(bytes) |
| 45 | if body != "" { |
| 46 | errStr += "\nBody: " + body |
| 47 | } |
| 48 | return errors.New(errStr) |
| 49 | } |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | func (*errorsCommand) Run(ctx Context, kongCtx *kong.Context) error { |
| 54 | switch kongCtx.Selected().Name { |
nothing calls this directly
no test coverage detected