Rails exception detection