catch the right exception in sequel