Better way of exception raising