Repair error reporting
This commit is contained in:
parent
2ddedc7673
commit
1654ad4c80
|
@ -70,7 +70,7 @@ export function changeExt(p: string, newext: string): string {
|
||||||
|
|
||||||
export function formatFailures(failures: Array<Diagnostic>, traceback = false): void {
|
export function formatFailures(failures: Array<Diagnostic>, traceback = false): void {
|
||||||
for (const d of failures) {
|
for (const d of failures) {
|
||||||
console.log(
|
console.error(
|
||||||
(d.type === 'error' ? chalk.redBright('[ERROR]') : chalk.yellowBright('[WARNING]'))
|
(d.type === 'error' ? chalk.redBright('[ERROR]') : chalk.yellowBright('[WARNING]'))
|
||||||
+ ' '
|
+ ' '
|
||||||
+ chalk.blueBright(formatPosition((d.detail as any).pos ?? d.file))
|
+ chalk.blueBright(formatPosition((d.detail as any).pos ?? d.file))
|
||||||
|
@ -81,6 +81,6 @@ export function formatFailures(failures: Array<Diagnostic>, traceback = false):
|
||||||
: ''));
|
: ''));
|
||||||
}
|
}
|
||||||
if (failures.length > 0) {
|
if (failures.length > 0) {
|
||||||
console.log();
|
console.error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ export function checkSchema(schema: M.Schema): M.Schema {
|
||||||
const checker = new Checker();
|
const checker = new Checker();
|
||||||
schema.definitions.forEach(checker.checkDefinition.bind(checker));
|
schema.definitions.forEach(checker.checkDefinition.bind(checker));
|
||||||
if (checker.problems.length > 0) {
|
if (checker.problems.length > 0) {
|
||||||
throw new Error(`Cannot produce unconverter: insufficient information in:\n` +
|
throw new Error(`Schema does not specify a bijection:\n` +
|
||||||
checker.problems.map(c => ' - ' + c).join('\n'));
|
checker.problems.map(c => ' - ' + c).join('\n'));
|
||||||
}
|
}
|
||||||
return schema;
|
return schema;
|
||||||
|
|
Loading…
Reference in New Issue