Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// console.log('Opening file: %s', path);
try {
fs.readFile(path, (err, data) => {
if (err) {
reject(ono(err, `Error opening file "${path}"`));
}
else {
resolve(data);
}
});
}
catch (err) {
reject(ono(err, `Error opening file "${path}"`));
}
}));
}
stringify: function yamlStringify (value, replacer, space) {
try {
let indent = (typeof space === "string" ? space.length : space) || 2;
return yaml.safeDump(value, { indent });
}
catch (e) {
if (e instanceof Error) {
throw e;
}
else {
// https://github.com/nodeca/js-yaml/issues/153
throw ono(e, e.message);
}
}
}
};
parse: function yamlParse (text, reviver) {
try {
return yaml.safeLoad(text);
}
catch (e) {
if (e instanceof Error) {
throw e;
}
else {
// https://github.com/nodeca/js-yaml/issues/153
throw ono(e, e.message);
}
}
},
let results = swaggerParser.$refs.values();
Object.keys(results).forEach((key) => {
editors.showResult(key, results[key]);
});
})
.catch((err) => {
editors.showError(ono(err));
analytics.trackError(err);
});
// Track the operation
counters[method]++;
analytics.trackEvent("button", "click", method, counters[method]);
}
catch (err) {
editors.showError(ono(err));
analytics.trackError(err);
}
}
.catch((err) => {
editors.showError(ono(err));
analytics.trackError(err);
});