Skip to main content
Version: 4.2.0

Error Codes

The SDK returns errors as BidMachineError (Swift) / BMError (Obj-C), a subclass of NSError. Two things are public:

  • error.code — the numeric category (Int, from NSError).
  • error.message — a human-readable description (String).

Switch on error.code against the numbers below to handle specific failures.

note

Named code constants are not part of the public API. The backing Code enum is internal, and there are no BMErrorCode* Obj-C constants — only the raw error.code number and error.message string are exposed. Switch on the number.

Code Reference

The internal case names are shown for orientation only — they are not callable from app code.

CodeInternal nameDescription
100connectionCan't connect to server.
101badContentResponse content is malformed or cannot be parsed.
102timeoutTimeout reached.
103noFillNo fill.
104adNotReadyAd is not ready to be shown.
105alreadyLoadingA load is already in progress.
106destroyedAd was destroyed.
107expiredAd was expired.
108internalUnknown internal error.
109serverServer failed to fulfill an apparently valid request.
110badRequestRequest contains bad syntax or cannot be fulfilled.
200headerBiddingAdapter / header-bidding network error.

Handling Errors

func didFailToLoadAd(adInfo: AdInfo?, error: BidMachineError) {
switch error.code {
case 103: print("No fill")
case 102: print("Timed out")
default: print("Load failed (\(error.code)): \(error.message)")
}
}
note

iOS does not expose a public log formatter or a cause property. Read error.message directly; an underlying NSError may be attached via NSUnderlyingErrorKey.