raise error correctly