Update error message.
Protect against divide-by-zero.
Allow reading from Console, e.g. for tests.
Update tests to rely on Console instead of LineEditor.