Ignore:
Timestamp:
2002-02-04T11:26:20+13:00 (22 years ago)
Author:
sjboddie
Message:

All error messages now go to error.txt (i.e. did away with errout.txt and
initout.txt and put what used to go to them to error.txt instead)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/cgiwrapper.cpp

    r2344 r2939  
    193193  errortext += "correctly.\n";
    194194
    195   text_t init_file = filename_cat (gsdlhome, "etc", "initout.txt");
    196   char *ifile = init_file.getcstr();
    197   ifstream initin (ifile);
    198   delete ifile;
    199   if (initin) {
    200     errortext += "The initialisation error log, " + init_file + ", contains the\n";
    201     errortext += "following information:\n\n";
    202     if (!debug) errortext += "<pre>\n";
    203 
    204     char c;
    205     initin.get(c);
    206     while (!initin.eof ()) {
    207       errortext.push_back(c);
    208       initin.get(c);
    209     }
    210    
    211     if (!debug) errortext += "</pre>\n";
    212 
    213     initin.close();
    214 
    215   } else {
    216     errortext += "Please consult " + init_file + " for more information.\n";
    217   }
    218 
    219   format_error_string (errorpage, errortext, debug);
    220 }
    221 
    222 static void page_errorparseargs (const text_t &gsdlhome, bool debug, text_t &errorpage) {
    223 
    224   text_t errortext = "An error occurred during the parsing of the cgi arguments.\n";
    225 
    226   text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
     195  text_t error_file = filename_cat (gsdlhome, "etc", "error.txt");
    227196  char *efile = error_file.getcstr();
    228197  ifstream errin (efile);
     
    239208      errin.get(c);
    240209    }
     210   
    241211    if (!debug) errortext += "</pre>\n";
     212
    242213    errin.close();
    243214
     
    249220}
    250221
    251 static void page_errorcgipage (const text_t &gsdlhome, bool debug, text_t &errorpage) {
    252 
    253   text_t errortext = "An error occurred during the construction of the cgi page.\n";
    254 
    255   text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
     222static void page_errorparseargs (const text_t &gsdlhome, bool debug, text_t &errorpage) {
     223
     224  text_t errortext = "An error occurred during the parsing of the cgi arguments.\n";
     225
     226  text_t error_file = filename_cat (gsdlhome, "etc", "error.txt");
    256227  char *efile = error_file.getcstr();
    257228  ifstream errin (efile);
     
    278249}
    279250
     251static void page_errorcgipage (const text_t &gsdlhome, bool debug, text_t &errorpage) {
     252
     253  text_t errortext = "An error occurred during the construction of the cgi page.\n";
     254
     255  text_t error_file = filename_cat (gsdlhome, "etc", "error.txt");
     256  char *efile = error_file.getcstr();
     257  ifstream errin (efile);
     258  delete efile;
     259  if (errin) {
     260    errortext += "The error log, " + error_file + ", contains the\n";
     261    errortext += "following information:\n\n";
     262    if (!debug) errortext += "<pre>\n";
     263
     264    char c;
     265    errin.get(c);
     266    while (!errin.eof ()) {
     267      errortext.push_back(c);
     268      errin.get(c);
     269    }
     270    if (!debug) errortext += "</pre>\n";
     271    errin.close();
     272
     273  } else {
     274    errortext += "Please consult " + error_file + " for more information.\n";
     275  }
     276
     277  format_error_string (errorpage, errortext, debug);
     278}
     279
    280280static void print_debug_info (receptionist &recpt) {
    281281
     
    289289       << "Configuration and initialization completed successfully.\n"
    290290       << "  Note that more debug information may be available in the\n"
    291        << "  initialization and error logs initout.txt and errout.txt\n"
    292        << "  in " << etc_dir << ".\n"
     291       << "  initialization and error log error.txt in " << etc_dir << ".\n"
    293292       << "------------------------------------------------------------\n\n";
    294293
     
    542541    }
    543542
    544     text_t init_file = filename_cat (gsdlhome, "etc", "initout.txt");
    545     char *iout = init_file.getcstr();
    546     ofstream initout (iout);
    547     delete iout;
    548     if (!recpt.init(initout)) {
     543    text_t error_file = filename_cat (gsdlhome, "etc", "error.txt");
     544    char *eout = error_file.getcstr();
     545    ofstream errout (eout, ios::app);
     546    delete eout;
     547    if (!recpt.init(errout)) {
    549548      // an error occurred during the initialisation
    550       initout.close();
     549      errout.close();
    551550      page_errorinit(gsdlhome, debug, errorpage);
    552551    }
    553     initout.close();
     552    errout.close();
    554553  }
    555554
     
    648647    // output page
    649648    if (errorpage.empty()) {
    650       text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
     649      text_t error_file = filename_cat (gsdlhome, "etc", "error.txt");
    651650      char *eout = error_file.getcstr();
    652651      ofstream errout (eout, ios::app);
Note: See TracChangeset for help on using the changeset viewer.