1 // $Header: /home/cvsroot/yaz++/zoom/Attic/zerr.cpp,v 1.1 2002-08-08 13:31:54 mike Exp $
3 // Z39.50 Error classes
6 #include <string.h> // for strerror(), strlen(), strcpy()
7 #include <stdio.h> // for sprintf()
8 #include <yaz/diagbib1.h>
13 error::error(int errcode) {
17 int error::errcode() const {
21 const char *error::errmsg() const {
23 sprintf(buf, "error #%d", code);
29 systemError::systemError() : error::error(errno){
33 int systemError::errcode() const {
37 const char *systemError::errmsg() const {
38 return strerror(code);
43 bib1Error::bib1Error(int errcode, const char *addinfo) :
44 error::error(errcode) {
45 info = new char[strlen(addinfo)+1];
46 strcpy((char*) info, addinfo);
49 bib1Error::~bib1Error() {
53 int bib1Error::errcode() const {
57 const char *bib1Error::errmsg() const {
58 return diagbib1_str(code);
61 const char *bib1Error::addinfo() const {
67 queryError::queryError(int qtype, const char *source) :
69 q = new char[strlen(source)+1];
70 strcpy((char*) q, source);
73 queryError::~queryError() {
77 int queryError::errcode() const {
81 const char *queryError::errmsg() const {
83 case PREFIX: return "bad prefix search";
84 case CCL: return "bad CCL search";
87 return "bad search (unknown type)";
90 const char *queryError::addinfo() const {