Added error reporting to main.cpp, added test for error reporting