Add example on_error callback.