Skip to content

Commit

Permalink
Add module name to storage manager; catch errors (#6596)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreischer authored Apr 26, 2021
1 parent 722afa1 commit 4d842d2
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions modules/permutiveRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import { getGlobal } from '../src/prebidGlobal.js'
import { submodule } from '../src/hook.js'
import { getStorageManager } from '../src/storageManager.js'
import { deepSetValue, deepAccess, isFn, mergeDeep } from '../src/utils.js'
import { deepSetValue, deepAccess, isFn, mergeDeep, logError } from '../src/utils.js'
import includes from 'core-js-pure/features/array/includes.js'
const MODULE_NAME = 'permutive'

export const storage = getStorageManager()
export const storage = getStorageManager(null, MODULE_NAME)

function init (config, userConsent) {
return true
Expand Down Expand Up @@ -60,13 +61,19 @@ function setSegments (reqBidsConfigObj, config) {
customFn(bid, data, acEnabled, utils, defaultFn)
} else if (defaultFn) {
defaultFn(bid, data, acEnabled)
} else {

}
})
})
}

function makeSafe (fn) {
try {
fn()
} catch (e) {
logError(e)
}
}

function getCustomBidderFn (config, bidder) {
const overwriteFn = deepAccess(config, `params.overwrites.${bidder}`)

Expand Down Expand Up @@ -170,8 +177,12 @@ function readSegments (key) {

/** @type {RtdSubmodule} */
export const permutiveSubmodule = {
name: 'permutive',
getBidRequestData: initSegments,
name: MODULE_NAME,
getBidRequestData: function (reqBidsConfigObj, callback, customConfig) {
makeSafe(function () {
initSegments(reqBidsConfigObj, callback, customConfig)
})
},
init: init
}

Expand Down

0 comments on commit 4d842d2

Please sign in to comment.