// error_handling.c - some useful error handling functions

#include <stdio.h>

#include "callback_error_handling.h"

//----------------------------------------------------------------------
// helper function if the program runs out of memory
void exitOnFatalErrorOutOfMemory(char* func_name)
{
  printf("Fatal Error: Out of Memory in function %s\n",func_name);
  exit(ERROR_OUT_OF_MEMORY);
}

//----------------------------------------------------------------------
// helper function if a function gets an illegal argument
void exitOnFatalErrorIllegalArgument(char* func_name)
{
  printf("Fatal Error: IllegalArgument in function %s\n",func_name);
  exit(ERROR_ILLEGAL_ARGUMENT);
}

//----------------------------------------------------------------------
// helper function if an index is out of bounds
void exitOnFatalErrorIndexOutOfBounds(char* func_name)
{
  printf("Fatal Error: IndexOutOfBounds in function %s\n",func_name);
  exit(ERROR_INDEX_OUT_OF_BOUNDS);
}

