mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(files) read: errors -> error
This commit is contained in:
parent
b387b65cdb
commit
320affbb38
3 changed files with 17 additions and 18 deletions
|
|
@ -156,12 +156,11 @@
|
|||
if (Config.ssl)
|
||||
filesList.push(KEY, CERT);
|
||||
|
||||
files.read(filesList, 'utf8', function(errors, files) {
|
||||
files.read(filesList, 'utf8', function(error, files) {
|
||||
var status, msg, names;
|
||||
|
||||
if (errors) {
|
||||
status = 'error';
|
||||
Util.log(errors);
|
||||
if (error) {
|
||||
Util.log(error);
|
||||
} else {
|
||||
status = 'ok';
|
||||
|
||||
|
|
|
|||
|
|
@ -6,26 +6,26 @@
|
|||
Util = require('../util');
|
||||
|
||||
object.read = function(files, options, callback) {
|
||||
var errors,
|
||||
done = [],
|
||||
var done = [],
|
||||
isDone = false,
|
||||
noOptions = Util.isFunction(options),
|
||||
readFiles = {},
|
||||
doneFunc = function (name, error, data) {
|
||||
done.pop();
|
||||
|
||||
if (!error)
|
||||
if (error)
|
||||
done = [];
|
||||
else
|
||||
readFiles[name] = data;
|
||||
else {
|
||||
if (!errors)
|
||||
errors = {};
|
||||
|
||||
errors[name] = error;
|
||||
}
|
||||
|
||||
if (!done.length)
|
||||
Util.exec(callback, errors, readFiles);
|
||||
if (!done.length && !isDone) {
|
||||
isDone = true;
|
||||
callback(error, readFiles);
|
||||
}
|
||||
};
|
||||
|
||||
Util.checkArgs(arguments, ['files', 'options', 'callback']);
|
||||
|
||||
if (noOptions) {
|
||||
callback = options;
|
||||
options = null;
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@
|
|||
})
|
||||
.concat(EXPECT_PATH);
|
||||
|
||||
files.read(filesList, 'utf8', function(errors, files) {
|
||||
files.read(filesList, 'utf8', function(error, files) {
|
||||
var isNotOk, expect, result,
|
||||
i = 0,
|
||||
template = {};
|
||||
|
||||
if (errors) {
|
||||
throw(console.log(errors));
|
||||
if (error) {
|
||||
throw(new Error(error));
|
||||
} else {
|
||||
Util.time('CloudFunc.buildFromJSON');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue