github.com/prebid/prebid-server/v2@v2.18.0/errortypes/code.go (about) 1 package errortypes 2 3 // Defines numeric codes for well-known errors. 4 const ( 5 UnknownErrorCode = 999 6 TimeoutErrorCode = iota 7 BadInputErrorCode 8 BlacklistedAppErrorCode 9 BadServerResponseErrorCode 10 FailedToRequestBidsErrorCode 11 BidderTemporarilyDisabledErrorCode 12 AccountDisabledErrorCode 13 AcctRequiredErrorCode 14 NoConversionRateErrorCode 15 MalformedAcctErrorCode 16 ModuleRejectionErrorCode 17 TmaxTimeoutErrorCode 18 FailedToMarshalErrorCode 19 FailedToUnmarshalErrorCode 20 ) 21 22 // Defines numeric codes for well-known warnings. 23 const ( 24 UnknownWarningCode = 10999 25 InvalidPrivacyConsentWarningCode = iota + 10000 26 AccountLevelDebugDisabledWarningCode 27 BidderLevelDebugDisabledWarningCode 28 DisabledCurrencyConversionWarningCode 29 AlternateBidderCodeWarningCode 30 MultiBidWarningCode 31 AdServerTargetingWarningCode 32 BidAdjustmentWarningCode 33 FloorBidRejectionWarningCode 34 InvalidBidResponseDSAWarningCode 35 SecCookieDeprecationLenWarningCode 36 SecBrowsingTopicsWarningCode 37 ) 38 39 // Coder provides an error or warning code with severity. 40 type Coder interface { 41 Code() int 42 Severity() Severity 43 } 44 45 // ReadCode returns the error or warning code, or UnknownErrorCode if unavailable. 46 func ReadCode(err error) int { 47 if e, ok := err.(Coder); ok { 48 return e.Code() 49 } 50 return UnknownErrorCode 51 }