suppress irrelevant errors from Decrees.load

This commit is contained in:
ansuz 2020-10-12 19:15:48 +05:30
parent 854e4c06ff
commit 45b063e378
2 changed files with 9 additions and 2 deletions

View File

@ -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,

View File

@ -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) {