Browse Source

catching errors

pull/34/head 1.0.6
Kevin Kwok 8 years ago
parent
commit
9d13b2339f
  1. 3
      src/browser/lang.js

3
src/browser/lang.js

@ -14,9 +14,12 @@ module.exports = function getLanguageData(req, res, cb){
var lang = req.options.lang; var lang = req.options.lang;
function saveDataFile(data){ function saveDataFile(data){
try {
db.put(lang, data, err => console.log('cached', lang, err)) db.put(lang, data, err => console.log('cached', lang, err))
} finally {
cb(data) cb(data)
} }
}
db.open({ compression: false }, err => { db.open({ compression: false }, err => {
if (err) return fetchLanguageData(req, res, cb); if (err) return fetchLanguageData(req, res, cb);

Loading…
Cancel
Save