Improve error throwing structure