add on-restart and on-error event support