MCPcopy
hub / github.com/benbjohnson/wtf / FormatError

Function FormatError

sqlite/sqlite.go:304–315  ·  view source on GitHub ↗

FormatError returns err as a WTF error, if possible. Otherwise returns the original error.

(err error)

Source from the content-addressed store, hash-verified

302// FormatError returns err as a WTF error, if possible.
303// Otherwise returns the original error.
304func FormatError(err error) error {
305 if err == nil {
306 return nil
307 }
308
309 switch err.Error() {
310 case "UNIQUE constraint failed: dial_memberships.dial_id, dial_memberships.user_id":
311 return wtf.Errorf(wtf.ECONFLICT, "Dial membership already exists.")
312 default:
313 return err
314 }
315}
316
317// logstr is a helper function for printing and returning a string.
318// It can be useful for printing out query text.

Callers 15

DialValuesMethod · 0.85
checkDialExistsFunction · 0.85
findDialsFunction · 0.85
createDialFunction · 0.85
updateDialFunction · 0.85
deleteDialFunction · 0.85
refreshDialValueFunction · 0.85
insertDialValueFunction · 0.85
publishDialEventFunction · 0.85
findAuthsFunction · 0.85
createAuthFunction · 0.85

Calls 2

ErrorfFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected