/*
 * Error.C - general error reporting function.
 *
 * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
 *                     University of Berne, Switzerland
 * Copyright (C) 1989, 1991, Craig E. Kolb
 * All rights reserved.
 *
 * This software may be freely copied, modified, and redistributed
 * provided that this copyright notice is preserved on all copies.
 *
 * You may not distribute this software, in whole or in part, as part of
 * any commercial product without the express consent of the authors.
 *
 * There is no warranty or other guarantee of fitness of this software
 * for any purpose.  It is provided solely "as is".
 *
 * Adapted from Craig Kolbs rayshade.
 */

#include <stdlib.h>
#include <stream.h>
#include "Error.h"
#include "Options.h"

void Error(errorType level, const rcString& msg)
{
  switch(level) {
    case ERR_ADVISE:
      if (!theOptions.quiet)
	cerr << "Warning: " << msg << ".\n";
      break;
    case ERR_WARN:
      cerr << "Warning: " << msg << ".\n";
      break;
    case ERR_ABORT:
      cerr << "Error: " << msg << "!\n";
      exit(1);
      break;
    case ERR_PANIC:
      cerr << "Fatal error: " << msg << "!\n";
      exit(2);
      break;
    default:
      cerr << "Unknown error: " << msg << ".\n";
      exit(3);
    }
}
