Throw proper exception