Shouldn't this clear `chain` before returning? Or rather assign the error and jump to `on_error`.