MCPcopy
hub / github.com/syncthing/syncthing / Run

Method Run

cmd/syncthing/cli/errors.go:28–51  ·  view source on GitHub ↗
(ctx Context)

Source from the content-addressed store, hash-verified

26}
27
28func (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
53func (*errorsCommand) Run(ctx Context, kongCtx *kong.Context) error {
54 switch kongCtx.Selected().Name {

Callers

nothing calls this directly

Calls 4

responseToBArrayFunction · 0.85
getClientMethod · 0.80
PostMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected