Unverified Commit b96b5fc7 authored by Merwane Bouri's avatar Merwane Bouri
Browse files

Ajout de historyException

parent f4225402
Pipeline #77752 passed with stages
in 17 seconds
......@@ -13,9 +13,20 @@ Cette classe représente un historique de Grids.
#define HISTORY_H
#include "grid.h"
#include <string>
#include <deque>
#include <exception>
class HistoryException : public std::exception
{
std::string _msg;
public:
HistoryException(const std::string& msg) : _msg(msg){}
virtual const char* what() const noexcept override
{
return _msg.c_str();
}
};
class History{
unsigned int nbMax;
std::deque<Grid> tab;
......@@ -30,7 +41,7 @@ public:
{
if(tab.size()>0)
return tab.back();
throw "wtf dude";
throw HistoryException("La pile est vide. \n");
}
bool isEmpty()
{
......
......@@ -33,5 +33,5 @@ Grid History::popGrid(){
tab.pop_back();
return tmp;
}
throw "bad";
throw HistoryException("La pile est vide. \n");
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment