There are two issues with undo.
The undo/redo buttons should be disabled
Ctrl+Z and Ctrl+Y shouldn't throw an error when the history is empty.
Probably related to the previous issue
Actually, the issues you describe are three separate bugs: the buttons' state doesn't reflect the undo/redo state, no error should be thrown and the undo error you get when using ctrl-z. They should all be fixed in the current HEAD.
I've tested ctrl-z and ctrl-y with HEAD and it looks good. Thanks.