home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / graphtal / error.c < prev    next >
C/C++ Source or Header  |  1992-10-19  |  1KB  |  46 lines

  1. /*
  2.  * Error.C - general error reporting function.
  3.  *
  4.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  */
  17.  
  18. #include <stdlib.h>
  19. #include <stream.h>
  20. #include "Error.h"
  21. #include "Options.h"
  22.  
  23. void Error(errorType level, const rcString& msg)
  24. {
  25.   switch(level) {
  26.     case ERR_ADVISE:
  27.       if (!theOptions.quiet)
  28.     cerr << "Warning: " << msg << ".\n";
  29.       break;
  30.     case ERR_WARN:
  31.       cerr << "Warning: " << msg << ".\n";
  32.       break;
  33.     case ERR_ABORT:
  34.       cerr << "Error: " << msg << "!\n";
  35.       exit(1);
  36.       break;
  37.     case ERR_PANIC:
  38.       cerr << "Fatal error: " << msg << "!\n";
  39.       exit(2);
  40.       break;
  41.     default:
  42.       cerr << "Unknown error: " << msg << ".\n";
  43.       exit(3);
  44.     }
  45. }
  46.