Adding support for setting on_error