#include <iostream>
#include <exception>
#include "ErrorHandlingModule.h"

namespace SAMSErrorHandling
{
	using namespace std;
	
	void Initialize(void)
	{
		cin.exceptions(cin.failbit);
	}
	
	int HandleNotANumberError(void)
	{
		cerr << "Input error - input may not have been a number." << endl;
		
		cin.clear(); //Clear the error state from the stream
		
		//Eat the bad input so we can pause the program
		char BadInput[5]; //Up to 5 characters
		cin >> BadInput;
		
		return 1; //An error occurred.
	}
	
	int HandleRuntimeError(runtime_error theRuntimeError)
	{
		cerr <<
		theRuntimeError.what() <<
		endl;
		
		return 1;
	}
}