Skip to content

Commit 4930622

Browse files
jaiminpanchal27mkendall07
authored andcommitted
Log error returned by PBS (#2335)
1 parent 4bdc91c commit 4930622

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

modules/prebidServerBidAdapter.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ const LEGACY_PROTOCOL = {
317317
if (bidder.no_cookie) {
318318
doBidderSync(bidder.usersync.type, bidder.usersync.url, bidder.bidder);
319319
}
320+
if (bidder.error) {
321+
utils.logWarn(`Prebid Server returned error: '${bidder.error}' for ${bidder.bidder}`);
322+
}
320323
});
321324
}
322325

test/spec/modules/prebidServerBidAdapter_spec.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,15 @@ const RESPONSE_OPENRTB_VIDEO = {
358358
},
359359
};
360360

361+
const RESPONSE_UNSUPPORTED_BIDDER = {
362+
'tid': '437fbbf5-33f5-487a-8e16-a7112903cfe5',
363+
'status': 'OK',
364+
'bidder_status': [{
365+
'bidder': '33Across',
366+
'error': 'Unsupported bidder'
367+
}]
368+
};
369+
361370
describe('S2S Adapter', () => {
362371
let adapter,
363372
addBidResponse = sinon.spy(),
@@ -559,6 +568,7 @@ describe('S2S Adapter', () => {
559568

560569
describe('response handler', () => {
561570
let server;
571+
let logWarnSpy;
562572

563573
beforeEach(() => {
564574
server = sinon.fakeServer.create();
@@ -569,6 +579,7 @@ describe('S2S Adapter', () => {
569579
sinon.stub(utils, 'getBidRequest').returns({
570580
bidId: '123'
571581
});
582+
logWarnSpy = sinon.spy(utils, 'logWarn');
572583
});
573584

574585
afterEach(() => {
@@ -578,6 +589,7 @@ describe('S2S Adapter', () => {
578589
utils.insertUserSyncIframe.restore();
579590
utils.logError.restore();
580591
cookie.cookieSet.restore();
592+
logWarnSpy.restore();
581593
});
582594

583595
// TODO: test dependent on pbjs_api_spec. Needs to be isolated
@@ -810,6 +822,25 @@ describe('S2S Adapter', () => {
810822
expect(response).to.have.property('adId', '123');
811823
expect(response).to.have.property('cpm', 10);
812824
});
825+
826+
it('should log warning for unsupported bidder', () => {
827+
server.respondWith(JSON.stringify(RESPONSE_UNSUPPORTED_BIDDER));
828+
829+
const s2sConfig = Object.assign({}, CONFIG, {
830+
bidders: ['33Across']
831+
});
832+
833+
const _config = {
834+
s2sConfig: s2sConfig,
835+
}
836+
837+
config.setConfig(_config);
838+
config.setConfig({s2sConfig: CONFIG});
839+
adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
840+
server.respond();
841+
842+
sinon.assert.calledOnce(logWarnSpy);
843+
});
813844
});
814845

815846
describe('s2sConfig', () => {

0 commit comments

Comments
 (0)