Use more general exception in type spec