All pastes #243688 Raw Edit

c_error.h

public cpp v1 · immutable
·published 2006-11-08 20:16 UTC
rendered paste body
#include "c_error.h"/* errors's management *//* ~~~ socket's error ~~~ *//* socket initialization's error */initError::initError(string buffer){  m_cause = buffer;}initError::~initError(){  }void initError::error(){  cout<<"FATAL ERROR: socket initialization's failed."<<endl;  cout<<"("<<m_cause<<")"<<endl;}void initError::solution(){  cout<<"solution: we quit."<<endl;  exit(1);}/* socket adressing's error */addressError::addressError(string buffer){  m_cause = buffer;}addressError::~addressError(){  }void addressError::error(){  cout<<"FATAL ERROR: socket adressing's failed."<<endl;  cout<<"("<<m_cause<<")"<<endl;}void addressError::solution(){  cout<<"solution: we quit."<<endl;  exit(1);}/* socket port definition's error */portError::portError(string buffer){  m_cause = buffer;}portError::~portError(){  }void portError::error(){  cout<<"FATAL ERROR: socket port definition's failed."<<endl;  cout<<"("<<m_cause<<")"<<endl;}void portError::solution(){  cout<<"solution: we quit."<<endl;  exit(1);}/* connection's error */connectError::connectError(string buffer){  m_cause = buffer;}connectError::~connectError(){  }void connectError::error(){  cout<<"FATAL ERROR: connection failed."<<endl;  cout<<"("<<m_cause<<")"<<endl;}void connectError::solution(){  cout<<"solution: we quit."<<endl;  exit(1);}/* sending's error */sendError::sendError(int a, string buffer){  m_cause = buffer;  m_type = a;}sendError::~sendError(){  }void sendError::error(){  if(m_type == -1) {	cout<<"FATAL ERROR: the sending failed."<<endl;	cout<<"("<<m_cause<<")"<<endl;	}  if (m_type == 1) {	cout<<"ERROR: bytes sent's number is lower than line's bytes."<<endl;	}}void sendError::solution(){  if(m_type == -1) {	cout<<"solution: we quit."<<endl;	exit(1);	}  if(m_type == 1) {	cout<<"solution: there is no solution,"<<endl;	cout<<"supervise the next send()..."<<endl;	}}/* reception's error */recvError::recvError(string buffer){  m_cause = buffer;}recvError::~recvError(){  }void recvError::error(){  cout<<"FATAL ERROR: the reception failed."<<endl;  cout<<"("<<m_cause<<")"<<endl;}void recvError::solution(){  cout<<"solution: we quit."<<endl;  exit(1);}/* socket closing's error */closeError::closeError(string buffer){  m_cause = buffer;}closeError::~closeError(){  }void closeError::error(){  cout<<"FATAL ERROR: socket closing's failed."<<endl;  cout<<"("<<m_cause<<")"<<endl;}void closeError::solution(){  cout<<"solution: we quit."<<endl;  exit(1);}/* ~~~ parsing's error ~~~ *//* setbuffer's error *//*setBufferError::setBufferError(int a, int b){  m_capacity = a;  m_lenght = b;}setBufferError::~setBufferError(){  }void setBufferError::error(){  cout<<"WARNING: m_buffer in setBuffer have "<<m_capacity<<" of capacity."<<endl;  cout<<"and m_buffer's lenght is "<<m_lenght<<"."<<endl;}void setBufferError::solution(){  cout<<"there is no solution,"<<endl;  cout<<"supervise m_buffer's capacity."<<endl;}*//* parse's error */parseError::parseError(string buffer){  m_when = buffer;}parseError::~parseError(){  }void parseError::error(){  cout<<"WARNING: parse line's failed."<<endl;  cout<<"(m_buffer's end found before "<<m_when<<")"<<endl;}void parseError::solution(){  cout<<"solution: there is no solution,"<<endl;  cout<<"supervise the next parse()"<<endl;}/* getLine's error */getLineError::getLineError(){  }getLineError::~getLineError(){  }void getLineError::error(){  cout<<"WARNING: getLine's failed."<<endl;  cout<<"(m_buffer end's found before m_line's definition)"<<endl;}void getLineError::solution(){  cout<<"solution: there is no solution,"<<endl;  cout<<"supervise the next getLine()..."<<endl;}