mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-01-12 22:47:24 +08:00
16 lines
372 B
JavaScript
16 lines
372 B
JavaScript
'use strict';
|
|
|
|
var FirebaseError = require('./error');
|
|
var cjson = require('cjson');
|
|
|
|
module.exports = function(path) {
|
|
try {
|
|
return cjson.load(path);
|
|
} catch (e) {
|
|
if (e.code === 'ENOENT') {
|
|
throw new FirebaseError('File ' + path + ' does not exist', {exit: 1});
|
|
}
|
|
throw new FirebaseError('Parse Error in ' + path + ':\n\n' + e.message);
|
|
}
|
|
};
|