MCPcopy
hub / github.com/rclone/rclone / errorHandler

Function errorHandler

backend/sugarsync/sugarsync.go:506–516  ·  view source on GitHub ↗

errorHandler parses errors from the body Errors seem to be HTML with containing the error text Can not move sync folder.

(resp *http.Response)

Source from the content-addressed store, hash-verified

504// Errors seem to be HTML with <h3> containing the error text
505// <h3>Can not move sync folder.</h3>
506func errorHandler(resp *http.Response) (err error) {
507 body, err := rest.ReadBody(resp)
508 if err != nil {
509 return fmt.Errorf("error reading error out of body: %w", err)
510 }
511 match := findError.FindSubmatch(body)
512 if len(match) < 2 || len(match[1]) == 0 {
513 return fmt.Errorf("HTTP error %v (%v) returned body: %q", resp.StatusCode, resp.Status, body)
514 }
515 return fmt.Errorf("HTTP error %v (%v): %s", resp.StatusCode, resp.Status, match[1])
516}
517
518// rootSlash returns root with a slash on if it is empty, otherwise empty string
519func (f *Fs) rootSlash() string {

Callers 1

TestErrorHandlerFunction · 0.70

Calls 2

ReadBodyFunction · 0.92
ErrorfMethod · 0.45

Tested by 1

TestErrorHandlerFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…