error callback

This commit is contained in:
2020-05-28 09:20:53 +02:00
parent c0b1e51872
commit c18d216d2e
5 changed files with 14 additions and 3 deletions

View File

@ -19,6 +19,11 @@ interface Option {
message?: string;
preset?: unknown[];
error?: string;
error_callback?: (
option: string,
value: unknown,
e: Error
) => unknown;
}
interface OptionProcess extends Option {

View File

@ -19,7 +19,8 @@ export abstract class OptionSource {
opt.filled = true;
}
catch (e) {
// could not assign
if (typeof opt.error_callback !== 'undefined')
opt.error_callback (opt.name, value, e);
}
}
}