Skip to content

Commit

Permalink
Added a log
Browse files Browse the repository at this point in the history
As noted by @diasdavid in #130 (comment)
  • Loading branch information
RichardLitt committed Jan 3, 2016
1 parent b69a54d commit d448dd3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/scripts/utils/localStorage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import _ from 'lodash'
import debug from 'debug'

const log = debug('utils:localStorage')
const warn = debug('utils:localStorage:warn')

// Utility to make interacting with localstorage less painful.
var ls = process.browser && window.localStorage
Expand Down Expand Up @@ -30,11 +34,13 @@ function doOperation (op) {
if (op === 'getItem') {
try {
result = JSON.parse(result)
} catch (e) {}
} catch (e) {
log('Unable to parse result as json. Message: %s', e.message)
}
}

return result
} catch (e) {
console.warn('LocalStorage error: ' + e.message)
warn(e.message)
}
}

0 comments on commit d448dd3

Please sign in to comment.