-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptions.cpp
More file actions
21 lines (18 loc) · 760 Bytes
/
Exceptions.cpp
File metadata and controls
21 lines (18 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "Exceptions.h"
#include <sstream>
CorsaException::CorsaException(int line, const char* file) noexcept : line(line), file(file){}
const char* CorsaException::what() const noexcept
{
std::ostringstream oss;
oss << getType() << std::endl << getOriginString();
buf = oss.str();
return buf.c_str();
}
const char* CorsaException::getType() const noexcept { return "Corsa Engine: Critical Error (Top Level Exception thrown)"; }
int CorsaException::getLine() const noexcept { return line; }
const std::string& CorsaException::getFile() const noexcept { return file; }
std::string CorsaException::getOriginString() const noexcept{
std::ostringstream oss;
oss << "Error thrown from:\n" << "[File] " << file << "\n[Line] " << line;
return oss.str();
}