update metadata queries to include edits

This commit is contained in:
ansuz
2019-06-27 18:21:12 +02:00
parent efd0efede4
commit b36f50f2c9
3 changed files with 71 additions and 40 deletions

View File

@@ -86,9 +86,8 @@ var handleCommand = function (meta, line) {
Meta.createLineHandler = function (ref, errorHandler) {
ref.meta = {};
errorHandler = errorHandler;
return function (err, line, index) {
var index = 0;
return function (err, line) {
if (err) {
return void errorHandler('METADATA_HANDLER_LINE_ERR', {
error: err,
@@ -98,11 +97,12 @@ Meta.createLineHandler = function (ref, errorHandler) {
}
if (Array.isArray(line)) {
index++;
try {
handleCommand(ref.meta, line);
} catch (err) {
} catch (err2) {
errorHandler("METADATA_COMMAND_ERR", {
error: err.stack,
error: err2.stack,
line: line,
});
}
@@ -110,6 +110,7 @@ Meta.createLineHandler = function (ref, errorHandler) {
}
if (index === 0 && typeof(line) === 'object') {
index++;
// special case!
ref.meta = line;
return;
@@ -117,7 +118,7 @@ Meta.createLineHandler = function (ref, errorHandler) {
errorHandler("METADATA_HANDLER_WEIRDLINE", {
line: line,
index: index
index: index++,
});
};
};