Include error context

@mguymon, @mattgillooly, adding error context to the on_error callback for easier post-mortem introspection.