MCPcopy Index your code
hub / github.com/google/go-github / Is

Method Is

github/github.go:1476–1517  ·  view source on GitHub ↗

Is returns whether the provided error equals this error.

(target error)

Source from the content-addressed store, hash-verified

1474
1475// Is returns whether the provided error equals this error.
1476func (r *ErrorResponse) Is(target error) bool {
1477 var v *ErrorResponse
1478 if !errors.As(target, &v) {
1479 return false
1480 }
1481
1482 if r.Message != v.Message || (r.DocumentationURL != v.DocumentationURL) ||
1483 !compareHTTPResponse(r.Response, v.Response) {
1484 return false
1485 }
1486
1487 // Compare Errors.
1488 if len(r.Errors) != len(v.Errors) {
1489 return false
1490 }
1491 for idx := range r.Errors {
1492 if r.Errors[idx] != v.Errors[idx] {
1493 return false
1494 }
1495 }
1496
1497 // Compare Block.
1498 if (r.Block != nil && v.Block == nil) || (r.Block == nil && v.Block != nil) {
1499 return false
1500 }
1501 if r.Block != nil && v.Block != nil {
1502 if r.Block.Reason != v.Block.Reason {
1503 return false
1504 }
1505 if (r.Block.CreatedAt != nil && v.Block.CreatedAt == nil) || (r.Block.CreatedAt ==
1506 nil && v.Block.CreatedAt != nil) {
1507 return false
1508 }
1509 if r.Block.CreatedAt != nil && v.Block.CreatedAt != nil {
1510 if *(r.Block.CreatedAt) != *(v.Block.CreatedAt) {
1511 return false
1512 }
1513 }
1514 }
1515
1516 return true
1517}
1518
1519// TwoFactorAuthError occurs when using HTTP Basic Authentication for a user
1520// that has two-factor authentication enabled. The request can be reattempted

Calls 1

compareHTTPResponseFunction · 0.85