Added classes for error handling. They come from an old project, and
they must be adapted to fit our specific needs