aboutsummaryrefslogblamecommitdiff
path: root/exc.cpp
blob: 167bf92f7a7d70b725689be1f3c3327aed54a1d7 (plain) (tree)
1
2
3
4
5
6
7
8
9


                 
                                                          
 
                                                    
 
                                                                         
                                                   
                                                  


                 

                                                             
 
#include "exc.h"
#include <cstdio>

GeneralError::GeneralError(ErrCode _code) : code(_code) {}

string GeneralError::get_msg() { return this->msg; }

TokenError::TokenError(string token, ErrCode code) : GeneralError(code) {
    static char buffer[1024];   // should be enough
    sprintf(buffer, ERR_MSG[code], token.c_str());
    msg = buffer;
}

NormalError::NormalError(ErrCode code) : GeneralError(code) {
    msg = ERR_MSG[code];
}