fix bug (autoedit does never finish on error)

Added an error handler.

Change-Id: Ib433027469fbe8143ac4eb27f38eca0dabbeb4df