// #NOTE: To keep things simple, all allocations for Error should be via GPAllocator.
// We really allocate two things: the Error struct and the error string copy.

enum class ErrorClass: s32 {
  NONE      = 0, // should not be used, just to avoid a default value being assigned.
  WARNING   = 1,
  ERROR     = 2,
  FATAL     = 3
};

// #downcasts to string
struct Error {
  s64 count;
  u8* data;
  ErrorClass severity = ErrorClass::NONE;
  s32 thread_id;
  s32 source_line;
  s32 path_length;
  char* path;
  
  // Linked list to errors
  Error* previous_error; // if we're passing errors up the callstack.
  Error* next_error;
  
  // Arena* arena;
  
  // Error () { memset(this, 0, sizeof(*this)); }
};

// string create_error(ErrorClass severity, string fmt, ...) {
  
// }

string to_string (Error error) {
  return { error.count, error.data };
}

// Will need to use __FILE__ and __LINE__ macros

// Error* new_error (string error_message, ErrorClass severity, Error* previous_error=nullptr);
// Error* append_error (Error* old_error, Error* new_error);
// void context_report_error (Error* error);
// void cleanup_error (Error* error);
