errortypes

package
v0.0.0-...-f16c7e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoErrorCode = iota
	TimeoutCode
	BadInputCode
	BadServerResponseCode
	FailedToRequestBidsCode
)

These define the error codes for all the errors enumerated in this package NoErrorCode is to reserve 0 for non error states.

View Source
const UnknownErrorCode = 999

We should use this code for any Error interface that is not in this package

Variables

This section is empty.

Functions

func DecodeError

func DecodeError(err error) int

DecodeError provides the error code for an error, as defined above

Types

type BadInput

type BadInput struct {
	Message string
}

BadInput should be used when returning errors which are caused by bad input. It should _not_ be used if the error is a server-side issue (e.g. failed to send the external request).

BadInputs will not be written to the app log, since it's not an actionable item for the Prebid Server hosts.

func (*BadInput) Code

func (err *BadInput) Code() int

func (*BadInput) Error

func (err *BadInput) Error() string

type BadServerResponse

type BadServerResponse struct {
	Message string
}

BadServerResponse should be used when returning errors which are caused by bad/unexpected behavior on the remote server.

For example:

  • The external server responded with a 500
  • The external server gave a malformed or unexpected response.

These should not be used to log _connection_ errors (e.g. "couldn't find host"), which may indicate config issues for the PBS host company

func (*BadServerResponse) Code

func (err *BadServerResponse) Code() int

func (*BadServerResponse) Error

func (err *BadServerResponse) Error() string

type Coder

type Coder interface {
	Code() int
}

Coder provides an interface to use if we want to check the code of an error type created in this package.

type FailedToRequestBids

type FailedToRequestBids struct {
	Message string
}

FailedToRequestBids is an error to cover the case where an adapter failed to generate any http requests to get bids, but did not generate any error messages. This should not happen in practice and will signal that an adapter is poorly coded. If there was something wrong with a request such that an adapter could not generate a bid, then it should generate an error explaining the deficiency. Otherwise it will be extremely difficult to debug the reason why an adapter is not bidding.

func (*FailedToRequestBids) Code

func (err *FailedToRequestBids) Code() int

func (*FailedToRequestBids) Error

func (err *FailedToRequestBids) Error() string

type Timeout

type Timeout struct {
	Message string
}

Timeout should be used to flag that a bidder failed to return a response because the PBS timeout timer expired before a result was recieved.

Timeouts will not be written to the app log, since it's not an actionable item for the Prebid Server hosts.

func (*Timeout) Code

func (err *Timeout) Code() int

func (*Timeout) Error

func (err *Timeout) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL