"throw new Exception" -> "throw Exception"

I don't know why I had it this way tbh
This commit is contained in:
Struma 2021-01-02 21:41:11 -05:00 committed by Roza
parent f45705f5c6
commit 5cc49efe2c
5 changed files with 13 additions and 13 deletions

View file

@ -927,7 +927,7 @@ void Bitmap::saveToFile(const char *filename)
SDL_Surface *surf = SDL_CreateRGBSurface(0, width(), height(),p->format->BitsPerPixel, p->format->Rmask,p->format->Gmask,p->format->Bmask,p->format->Amask);
if (!surf)
throw new Exception(Exception::SDLError, "Failed to save bitmap: %s", SDL_GetError());
throw Exception(Exception::SDLError, "Failed to save bitmap: %s", SDL_GetError());
getRaw(surf->pixels, surf->w * surf->h * 4);
@ -935,7 +935,7 @@ void Bitmap::saveToFile(const char *filename)
int rc = SDL_SaveBMP(surf, fn_normalized.c_str());
SDL_FreeSurface(surf);
if (rc) throw new Exception(Exception::SDLError, "%s", SDL_GetError());
if (rc) throw Exception(Exception::SDLError, "%s", SDL_GetError());
}
void Bitmap::hueChange(int hue)

View file

@ -34,7 +34,7 @@ std::string filesystemImpl::contentsOfFileAsString(const char *path) {
ret = std::string ( (std::istreambuf_iterator<char>(ifs) ),
(std::istreambuf_iterator<char>() ) );
} catch (...) {
throw new Exception(Exception::NoFileError, "Failed to read file at %s", path);
throw Exception(Exception::NoFileError, "Failed to read file at %s", path);
}
return ret;
@ -60,7 +60,7 @@ std::string filesystemImpl::getCurrentDirectory() {
try {
ret = std::string(fs::current_path().string());
} catch (...) {
throw new Exception(Exception::MKXPError, "Failed to retrieve current path");
throw Exception(Exception::MKXPError, "Failed to retrieve current path");
}
return ret;
}

View file

@ -24,7 +24,7 @@ bool filesystemImpl::fileExists(const char *path) {
std::string filesystemImpl::contentsOfFileAsString(const char *path) {
NSString *fileContents = [NSString stringWithContentsOfFile: PATHTONS(path)];
if (fileContents == nil)
throw new Exception(Exception::NoFileError, "Failed to read file at %s", path);
throw Exception(Exception::NoFileError, "Failed to read file at %s", path);
return std::string(fileContents.UTF8String);
@ -67,7 +67,7 @@ NSString *getPathForAsset_internal(const char *baseName, const char *ext) {
std::string filesystemImpl::getPathForAsset(const char *baseName, const char *ext) {
NSString *assetPath = getPathForAsset_internal(baseName, ext);
if (assetPath == nil)
throw new Exception(Exception::NoFileError, "Failed to find the asset named %s.%s", baseName, ext);
throw Exception(Exception::NoFileError, "Failed to find the asset named %s.%s", baseName, ext);
return std::string(NSTOPATH(getPathForAsset_internal(baseName, ext)));
}
@ -78,7 +78,7 @@ std::string filesystemImpl::contentsOfAssetAsString(const char *baseName, const
// This should never fail
if (fileContents == nil)
throw new Exception(Exception::MKXPError, "Failed to read file at %s", path.UTF8String);
throw Exception(Exception::MKXPError, "Failed to read file at %s", path.UTF8String);
return std::string(fileContents.UTF8String);

View file

@ -1234,14 +1234,14 @@ char *Input::getClipboardText()
{
char *tx = SDL_GetClipboardText();
if (!tx)
throw new Exception(Exception::SDLError, "Failed to get clipboard text: %s", SDL_GetError());
throw Exception(Exception::SDLError, "Failed to get clipboard text: %s", SDL_GetError());
return tx;
}
void Input::setClipboardText(char *text)
{
if (SDL_SetClipboardText(text) < 0)
throw new Exception(Exception::SDLError, "Failed to set clipboard text: %s", SDL_GetError());
throw Exception(Exception::SDLError, "Failed to set clipboard text: %s", SDL_GetError());
}
Input::~Input()

View file

@ -46,7 +46,7 @@ const char *urlErrorNames[] = {
LUrlParser::ParseURL readURL(const char *url) {
LUrlParser::ParseURL p = LUrlParser::ParseURL::parseURL(std::string(url));
if (!p.isValid() || p.errorCode_){
throw new Exception(Exception::MKXPError, "Invalid URL: %s", urlErrorNames[p.errorCode_]);
throw Exception(Exception::MKXPError, "Invalid URL: %s", urlErrorNames[p.errorCode_]);
}
return p;
}
@ -132,7 +132,7 @@ HTTPResponse HTTPRequest::get() {
else {
int err = result.error();
const char *errname = httpErrorNames[err];
throw new Exception(Exception::MKXPError, "Failed to GET %s (%i: %s)", destination.c_str(), err, errname);
throw Exception(Exception::MKXPError, "Failed to GET %s (%i: %s)", destination.c_str(), err, errname);
}
return ret;
@ -165,7 +165,7 @@ HTTPResponse HTTPRequest::post(StringMap &postData) {
else {
int err = result.error();
const char *errname = httpErrorNames[err];
throw new Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, errname);
throw Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, errname);
}
return ret;
}
@ -192,7 +192,7 @@ HTTPResponse HTTPRequest::post(const char *body, const char *content_type) {
}
else {
int err = result.error();
throw new Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, httpErrorNames[err]);
throw Exception(Exception::MKXPError, "Failed to POST %s (%i: %s)", destination.c_str(), err, httpErrorNames[err]);
}
return ret;
}