suppress irrelevant errors from Decrees.load

pull/1/head
ansuz 4 years ago
parent 854e4c06ff
commit 45b063e378

@ -10,7 +10,7 @@ module.exports.create = function (Env) {
nThen(function (w) {
Decrees.load(Env, w(function (err) {
if (err && err.code !== "ENOENT") {
if (err) {
log.error('DECREES_LOADING', {
error: err.code || err,
message: err.message,

@ -182,9 +182,16 @@ var Schedule = require("./schedule");
var Fse = require("fs-extra");
var nThen = require("nthen");
Decrees.load = function (Env, cb) {
Decrees.load = function (Env, _cb) {
Env.scheduleDecree = Env.scheduleDecree || Schedule();
var cb = Util.once(Util.mkAsync(function (err) {
if (err && err.code !== 'ENOENT') {
return void _cb(err);
}
_cb();
}));
Env.scheduleDecree.blocking('', function (unblock) {
var done = Util.once(Util.both(cb, unblock));
nThen(function (w) {

Loading…
Cancel
Save