mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove custom base Exception class
This commit is contained in:
parent
61dfb3dac7
commit
02c58a6c5a
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/core/Exception.hpp>
|
||||
#include <openrct2/core/Math.hpp>
|
||||
#include <openrct2/core/Memory.hpp>
|
||||
#include <openrct2/drawing/IDrawingContext.h>
|
||||
|
@ -182,13 +181,13 @@ public:
|
|||
{
|
||||
char szRequiredVersion[32];
|
||||
snprintf(szRequiredVersion, 32, "OpenGL %d.%d", requiredVersion.Major, requiredVersion.Minor);
|
||||
throw Exception(std::string(szRequiredVersion) + std::string(" not available."));
|
||||
throw std::runtime_error(std::string(szRequiredVersion) + std::string(" not available."));
|
||||
}
|
||||
SDL_GL_MakeCurrent(_window, _context);
|
||||
|
||||
if (!OpenGLAPI::Initialise())
|
||||
{
|
||||
throw Exception("Unable to initialise OpenGL.");
|
||||
throw std::runtime_error("Unable to initialise OpenGL.");
|
||||
}
|
||||
|
||||
_drawingContext->Initialise();
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#ifndef DISABLE_OPENGL
|
||||
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/core/Exception.hpp>
|
||||
#include <openrct2/core/FileStream.hpp>
|
||||
#include <openrct2/core/Memory.hpp>
|
||||
#include <openrct2/core/Path.hpp>
|
||||
|
@ -51,7 +50,7 @@ OpenGLShader::OpenGLShader(const char * name, GLenum type)
|
|||
Console::Error::WriteLine("Error compiling %s", path);
|
||||
Console::Error::WriteLine(buffer);
|
||||
|
||||
throw Exception("Error compiling shader.");
|
||||
throw std::runtime_error("Error compiling shader.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +114,7 @@ OpenGLShaderProgram::OpenGLShaderProgram(const char * name)
|
|||
Console::Error::WriteLine("Error linking %s", name);
|
||||
Console::Error::WriteLine(buffer);
|
||||
|
||||
throw Exception("Failed to link OpenGL shader.");
|
||||
throw std::runtime_error("Failed to link OpenGL shader.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ bool KeyboardShortcuts::Load()
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::WriteLine("Error reading shortcut keys: %s", ex.GetMessage());
|
||||
Console::WriteLine("Error reading shortcut keys: %s", ex.what());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ bool KeyboardShortcuts::Save()
|
|||
}
|
||||
result = true;
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::WriteLine("Error writing shortcut keys: %s", ex.GetMessage());
|
||||
Console::WriteLine("Error writing shortcut keys: %s", ex.what());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -448,9 +448,9 @@ namespace OpenRCT2
|
|||
handle_park_load_failure_with_title_opt(&result, path.c_str(), loadTitleScreenFirstOnFail);
|
||||
}
|
||||
}
|
||||
catch (const Exception& e)
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
Console::Error::WriteLine(e.GetMessage());
|
||||
Console::Error::WriteLine(e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -34,7 +34,7 @@ bool TryClassifyFile(const std::string &path, ClassifiedFileInfo * result)
|
|||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
return TryClassifyFile(&fs, result);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -87,10 +87,10 @@ static bool TryClassifyAsS6(IStream * stream, ClassifiedFileInfo * result)
|
|||
result->Version = s6Header.version;
|
||||
success = true;
|
||||
}
|
||||
catch (const Exception& e)
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
// Exceptions are likely to occur if file is not S6 format
|
||||
log_verbose(e.GetMessage());
|
||||
log_verbose(e.what());
|
||||
}
|
||||
stream->SetPosition(originalPosition);
|
||||
return success;
|
||||
|
@ -123,9 +123,9 @@ static bool TryClassifyAsS4(IStream * stream, ClassifiedFileInfo * result)
|
|||
success = true;
|
||||
}
|
||||
}
|
||||
catch (const Exception& e)
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
Console::Error::WriteLine(e.GetMessage());
|
||||
Console::Error::WriteLine(e.what());
|
||||
}
|
||||
|
||||
stream->SetPosition(originalPosition);
|
||||
|
@ -158,9 +158,9 @@ static bool TryClassifyAsTD4_TD6(IStream * stream, ClassifiedFileInfo * result)
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (const Exception& e)
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
Console::Error::WriteLine(e.GetMessage());
|
||||
Console::Error::WriteLine(e.what());
|
||||
}
|
||||
|
||||
return success;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#pragma warning(disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
|
||||
|
||||
#include <png.h>
|
||||
#include "core/Exception.hpp"
|
||||
#include "core/FileStream.hpp"
|
||||
#include "core/Guard.hpp"
|
||||
#include "core/Memory.hpp"
|
||||
|
@ -133,7 +132,7 @@ namespace Imaging
|
|||
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
*pixels = nullptr;
|
||||
if (width != nullptr) *width = 0;
|
||||
|
@ -183,7 +182,7 @@ namespace Imaging
|
|||
// Set error handler
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
throw Exception("PNG ERROR");
|
||||
throw std::runtime_error("PNG ERROR");
|
||||
}
|
||||
|
||||
// Write header
|
||||
|
@ -207,7 +206,7 @@ namespace Imaging
|
|||
png_write_end(png_ptr, nullptr);
|
||||
result = true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -243,7 +242,7 @@ namespace Imaging
|
|||
// Set error handler
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
throw Exception("PNG ERROR");
|
||||
throw std::runtime_error("PNG ERROR");
|
||||
}
|
||||
|
||||
// Write header
|
||||
|
@ -265,7 +264,7 @@ namespace Imaging
|
|||
png_write_end(png_ptr, nullptr);
|
||||
result = true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "config/Config.h"
|
||||
#include "core/Console.hpp"
|
||||
#include "core/Exception.hpp"
|
||||
#include "core/Guard.hpp"
|
||||
#include "core/Path.hpp"
|
||||
#include "core/String.hpp"
|
||||
|
|
|
@ -364,7 +364,7 @@ void audio_init_ride_sounds_and_info()
|
|||
rideMusicInfo->length = fs.GetLength();
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <memory>
|
||||
#include "../common.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../FileClassifier.h"
|
||||
|
@ -112,9 +111,9 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator * enumerat
|
|||
importer->Load(sourcePath);
|
||||
importer->Import();
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
Console::Error::WriteLine(ex.what());
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
|
@ -143,9 +142,9 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator * enumerat
|
|||
exporter->SaveGame(destinationPath);
|
||||
}
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
Console::Error::WriteLine(ex.what());
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <memory>
|
||||
#include "../Context.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/File.h"
|
||||
#include "../core/FileStream.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
|
@ -538,7 +537,7 @@ namespace Config
|
|||
ReadFont(reader.get());
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -559,7 +558,7 @@ namespace Config
|
|||
ReadFont(reader.get());
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -580,10 +579,10 @@ namespace Config
|
|||
WriteFont(writer.get());
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::WriteLine("Error saving to '%s'", path.c_str());
|
||||
Console::WriteLine(ex.GetMessage());
|
||||
Console::WriteLine(ex.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#if defined(DEBUG) && defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef GetMessage
|
||||
#endif
|
||||
|
||||
#include "Diagnostics.hpp"
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
class Exception : public std::exception
|
||||
{
|
||||
public:
|
||||
Exception() : Exception("") { }
|
||||
explicit Exception(const char * message) : Exception(std::string(message)) { }
|
||||
explicit Exception(const std::string &message) : std::exception(), _message(message) { }
|
||||
|
||||
virtual ~Exception() { }
|
||||
|
||||
const char * what() const throw() override { return _message.c_str(); }
|
||||
const char * GetMessage() const { return _message.c_str(); }
|
||||
|
||||
private:
|
||||
std::string _message;
|
||||
};
|
|
@ -143,7 +143,7 @@ extern "C"
|
|||
*outBuffer = File::ReadAllBytes(String::ToStd(path), outLength);
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ extern "C"
|
|||
File::WriteAllBytes(String::ToStd(path), buffer, length);
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef GetMessage
|
||||
#endif
|
||||
|
||||
#include "../Version.h"
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include "../common.h"
|
||||
#include "Exception.hpp"
|
||||
#include "Memory.hpp"
|
||||
|
||||
enum {
|
||||
|
@ -112,9 +112,8 @@ interface IStream
|
|||
void WriteString(const std::string &string);
|
||||
};
|
||||
|
||||
class IOException : public Exception
|
||||
class IOException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit IOException(const char * message) : Exception(message) { }
|
||||
explicit IOException(const std::string &message) : Exception(message) { }
|
||||
explicit IOException(const std::string &message) : std::runtime_error(message) { }
|
||||
};
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <jansson.h>
|
||||
|
||||
#include "../common.h"
|
||||
#include "Exception.hpp"
|
||||
|
||||
namespace Json
|
||||
{
|
||||
|
@ -30,13 +30,13 @@ namespace Json
|
|||
void WriteToFile(const utf8 * path, const json_t * json, size_t flags = 0);
|
||||
}
|
||||
|
||||
class JsonException final : public Exception
|
||||
class JsonException final : public std::runtime_error
|
||||
{
|
||||
private:
|
||||
json_error_t _jsonError = { 0 };
|
||||
|
||||
public:
|
||||
explicit JsonException(const char * message) : Exception(message) { }
|
||||
explicit JsonException(const std::string &message) : std::runtime_error(message) { }
|
||||
|
||||
explicit JsonException(const json_error_t * jsonError) : JsonException(jsonError->text)
|
||||
{
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace Zip
|
|||
{
|
||||
result = new ZipArchive(path, access);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace Zip {
|
|||
try {
|
||||
result = new ZipArchive(path, access);
|
||||
}
|
||||
catch (Exception) {
|
||||
catch (const std::exception &) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include <stdexcept>
|
||||
#include "../Context.h"
|
||||
#include "../ui/UiContext.h"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../interface/Screenshot.h"
|
||||
#include "../paint/Painter.h"
|
||||
#include "IDrawingContext.h"
|
||||
|
@ -108,7 +107,7 @@ extern "C"
|
|||
drawingEngine->SetVSync(gConfigGeneral.use_vsync);
|
||||
_drawingEngine = drawingEngine;
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
delete _painter;
|
||||
_painter = nullptr;
|
||||
|
@ -117,13 +116,13 @@ extern "C"
|
|||
if (_drawingEngineType == DRAWING_ENGINE_SOFTWARE)
|
||||
{
|
||||
_drawingEngineType = DRAWING_ENGINE_NONE;
|
||||
log_error(ex.GetMessage());
|
||||
log_error(ex.what());
|
||||
log_fatal("Unable to initialise a drawing engine.");
|
||||
exit(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error(ex.GetMessage());
|
||||
log_error(ex.what());
|
||||
log_error("Unable to initialise drawing engine. Falling back to software.");
|
||||
|
||||
// Fallback to software
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#pragma endregion
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <stdexcept>
|
||||
#include "../common.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../Context.h"
|
||||
|
@ -69,7 +69,7 @@ static inline uint32 rctc_to_rct2_index(uint32 image)
|
|||
else if (image >= 23804 && image < 24670) return image - 43;
|
||||
else if (image >= 24674 && image < 28244) return image - 47;
|
||||
else if (image >= 28246 ) return image - 49;
|
||||
else throw Exception("Invalid RCTC g1.dat file");
|
||||
else throw std::runtime_error("Invalid RCTC g1.dat file");
|
||||
}
|
||||
|
||||
static void read_and_convert_gxdat(IStream * stream, size_t count, bool is_rctc, rct_g1_element *elements)
|
||||
|
@ -206,7 +206,7 @@ extern "C"
|
|||
|
||||
if (header.num_entries < SPR_G1_END)
|
||||
{
|
||||
throw Exception("Not enough elements in g1.dat");
|
||||
throw std::runtime_error("Not enough elements in g1.dat");
|
||||
}
|
||||
|
||||
// Read element headers
|
||||
|
@ -226,7 +226,7 @@ extern "C"
|
|||
}
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_fatal("Unable to load g1 graphics");
|
||||
if (!gOpenRCT2Headless)
|
||||
|
@ -283,7 +283,7 @@ extern "C"
|
|||
}
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_fatal("Unable to load g2 graphics");
|
||||
if (!gOpenRCT2Headless)
|
||||
|
@ -378,7 +378,7 @@ extern "C"
|
|||
_csgLoaded = true;
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_error("Unable to load csg graphics");
|
||||
return false;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#pragma warning(disable : 4706) // assignment within conditional expression
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <jansson.h>
|
||||
|
||||
|
@ -258,7 +259,7 @@ static const WindowThemeDesc * GetWindowThemeDescriptor(const utf8 * windowClass
|
|||
|
||||
static void ThrowThemeLoadException()
|
||||
{
|
||||
throw Exception("Invalid JSON UI theme entry.");
|
||||
throw std::runtime_error("Invalid JSON UI theme entry.");
|
||||
}
|
||||
|
||||
#pragma region UIThemeEntry
|
||||
|
@ -412,9 +413,9 @@ bool UITheme::WriteToFile(const utf8 * path) const
|
|||
Json::WriteToFile(path, jsonTheme, JSON_INDENT(4) | JSON_PRESERVE_ORDER);
|
||||
result = true;
|
||||
}
|
||||
catch (const Exception & ex)
|
||||
catch (const std::exception & ex)
|
||||
{
|
||||
log_error("Unable to save %s: %s", path, ex.GetMessage());
|
||||
log_error("Unable to save %s: %s", path, ex.what());
|
||||
result = false;
|
||||
}
|
||||
|
||||
|
@ -467,7 +468,7 @@ UITheme * UITheme::FromJson(const json_t * json)
|
|||
|
||||
return result;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
delete result;
|
||||
throw;
|
||||
|
@ -483,7 +484,7 @@ UITheme * UITheme::FromFile(const utf8 * path)
|
|||
json = Json::ReadFromFile(path);
|
||||
result = UITheme::FromJson(json);
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_error("Unable to read theme: %s", path);
|
||||
result = nullptr;
|
||||
|
|
|
@ -87,10 +87,10 @@ public:
|
|||
fs.Read(fileData, fileLength);
|
||||
fileData[fileLength] = '\0';
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Memory::Free(fileData);
|
||||
log_error("Unable to open %s: %s", path, ex.GetMessage());
|
||||
log_error("Unable to open %s: %s", path, ex.what());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include <stdexcept>
|
||||
#include "../Context.h"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../OpenRCT2.h"
|
||||
|
@ -247,7 +248,7 @@ bool Network::BeginClient(const char* host, uint16 port)
|
|||
auto fs = FileStream(keyPath, FILE_MODE_WRITE);
|
||||
_key.SavePrivate(&fs);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_error("Unable to save private key at %s.", keyPath);
|
||||
return false;
|
||||
|
@ -263,7 +264,7 @@ bool Network::BeginClient(const char* host, uint16 port)
|
|||
auto fs = FileStream(keyPath, FILE_MODE_WRITE);
|
||||
_key.SavePublic(&fs);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_error("Unable to save public key at %s.", keyPath);
|
||||
return false;
|
||||
|
@ -277,7 +278,7 @@ bool Network::BeginClient(const char* host, uint16 port)
|
|||
auto fs = FileStream(keyPath, FILE_MODE_OPEN);
|
||||
ok = _key.LoadPrivate(&fs);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_error("Unable to read private key from %s.", keyPath);
|
||||
return false;
|
||||
|
@ -312,9 +313,9 @@ bool Network::BeginServer(uint16 port, const char* address)
|
|||
{
|
||||
listening_socket->Listen(address, port);
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
Console::Error::WriteLine(ex.what());
|
||||
Close();
|
||||
return false;
|
||||
}
|
||||
|
@ -816,9 +817,9 @@ void Network::SaveGroups()
|
|||
{
|
||||
Json::WriteToFile(path, jsonGroupsCfg, JSON_INDENT(4) | JSON_PRESERVE_ORDER);
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
log_error("Unable to save %s: %s", path, ex.GetMessage());
|
||||
log_error("Unable to save %s: %s", path, ex.what());
|
||||
}
|
||||
|
||||
json_decref(jsonGroupsCfg);
|
||||
|
@ -865,8 +866,8 @@ void Network::LoadGroups()
|
|||
if (platform_file_exists(path)) {
|
||||
try {
|
||||
json = Json::ReadFromFile(path);
|
||||
} catch (const Exception &e) {
|
||||
log_error("Failed to read %s as JSON. Setting default groups. %s", path, e.GetMessage());
|
||||
} catch (const std::exception &e) {
|
||||
log_error("Failed to read %s as JSON. Setting default groups. %s", path, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -929,9 +930,9 @@ void Network::AppendLog(std::ostream &fs, const std::string &s)
|
|||
fs.write(buffer, strlen(buffer));
|
||||
}
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
log_error("%s", ex.GetMessage());
|
||||
log_error("%s", ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1680,10 +1681,10 @@ void Network::Client_Handle_TOKEN(NetworkConnection& connection, NetworkPacket&
|
|||
auto fs = FileStream(keyPath, FILE_MODE_OPEN);
|
||||
if (!_key.LoadPrivate(&fs))
|
||||
{
|
||||
throw Exception();
|
||||
throw std::runtime_error("Failed to load private key.");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_error("Failed to load key %s", keyPath);
|
||||
connection.SetLastDisconnectReason(STR_MULTIPLAYER_VERIFICATION_FAILURE);
|
||||
|
@ -1887,13 +1888,13 @@ void Network::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacket& p
|
|||
const char *signature = (const char *)packet.Read(sigsize);
|
||||
if (signature == nullptr)
|
||||
{
|
||||
throw Exception();
|
||||
throw std::runtime_error("Failed to read packet.");
|
||||
}
|
||||
|
||||
auto ms = MemoryStream(pubkey, strlen(pubkey));
|
||||
if (!connection.Key.LoadPublic(&ms))
|
||||
{
|
||||
throw Exception();
|
||||
throw std::runtime_error("Failed to load public key.");
|
||||
}
|
||||
|
||||
bool verified = connection.Key.Verify(connection.Challenge.data(), connection.Challenge.size(), signature, sigsize);
|
||||
|
@ -1917,7 +1918,7 @@ void Network::Server_Handle_AUTH(NetworkConnection& connection, NetworkPacket& p
|
|||
log_verbose("Signature verification failed!");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
connection.AuthStatus = NETWORK_AUTH_VERIFICATIONFAILURE;
|
||||
log_verbose("Signature verification failed, invalid data!");
|
||||
|
@ -2079,7 +2080,7 @@ bool Network::LoadMap(IStream * stream)
|
|||
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
|
||||
result = true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
|
@ -2125,7 +2126,7 @@ bool Network::SaveMap(IStream * stream, const std::vector<const ObjectRepository
|
|||
|
||||
result = true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
|
@ -3178,7 +3179,7 @@ void network_send_password(const char* password)
|
|||
auto fs = FileStream(keyPath, FILE_MODE_OPEN);
|
||||
gNetwork._key.LoadPrivate(&fs);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
log_error("Error reading private key from %s.", keyPath);
|
||||
return;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "NetworkTypes.h"
|
||||
#include "NetworkAction.h"
|
||||
#include "NetworkGroup.h"
|
||||
#include "../core/Exception.hpp"
|
||||
|
||||
NetworkGroup::NetworkGroup()
|
||||
{
|
||||
|
@ -39,7 +38,7 @@ NetworkGroup NetworkGroup::FromJson(const json_t * json)
|
|||
|
||||
if (jsonId == nullptr || jsonName == nullptr || jsonPermissions == nullptr)
|
||||
{
|
||||
throw Exception("Missing group data");
|
||||
throw std::runtime_error("Missing group data");
|
||||
}
|
||||
|
||||
group.Id = (uint8)json_integer_value(jsonId);
|
||||
|
|
|
@ -107,9 +107,9 @@ void NetworkUserManager::Load()
|
|||
}
|
||||
json_decref(jsonUsers);
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine("Failed to read %s as JSON. %s", path, ex.GetMessage());
|
||||
Console::Error::WriteLine("Failed to read %s as JSON. %s", path, ex.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void NetworkUserManager::Save()
|
|||
jsonUsers = Json::ReadFromFile(path);
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ extern "C"
|
|||
serverInfo->maxplayers = 0;
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Memory::FreeArray(entries, numEntries);
|
||||
numEntries = 0;
|
||||
|
@ -88,7 +88,7 @@ extern "C"
|
|||
}
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <cmath>
|
||||
#include <chrono>
|
||||
#include <future>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
#undef GetMessage
|
||||
#define LAST_SOCKET_ERROR() WSAGetLastError()
|
||||
#undef EWOULDBLOCK
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
|
@ -59,7 +59,6 @@
|
|||
#endif // defined(__linux__)
|
||||
#endif // _WIN32
|
||||
|
||||
#include "../core/Exception.hpp"
|
||||
#include "TcpSocket.h"
|
||||
|
||||
constexpr auto CONNECT_TIMEOUT = std::chrono::milliseconds(3000);
|
||||
|
@ -70,11 +69,10 @@ constexpr auto CONNECT_TIMEOUT = std::chrono::milliseconds(3000);
|
|||
|
||||
class TcpSocket;
|
||||
|
||||
class SocketException : public Exception
|
||||
class SocketException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit SocketException(const char * message) : Exception(message) { }
|
||||
explicit SocketException(const std::string &message) : Exception(message) { }
|
||||
explicit SocketException(const std::string &message) : std::runtime_error(message) { }
|
||||
};
|
||||
|
||||
class TcpSocket final : public ITcpSocket
|
||||
|
@ -121,7 +119,7 @@ public:
|
|||
{
|
||||
if (_status != SOCKET_STATUS_CLOSED)
|
||||
{
|
||||
throw Exception("Socket not closed.");
|
||||
throw std::runtime_error("Socket not closed.");
|
||||
}
|
||||
|
||||
sockaddr_storage ss;
|
||||
|
@ -168,7 +166,7 @@ public:
|
|||
throw SocketException("Failed to set non-blocking mode.");
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
CloseSocket();
|
||||
throw;
|
||||
|
@ -182,7 +180,7 @@ public:
|
|||
{
|
||||
if (_status != SOCKET_STATUS_LISTENING)
|
||||
{
|
||||
throw Exception("Socket not listening.");
|
||||
throw std::runtime_error("Socket not listening.");
|
||||
}
|
||||
struct sockaddr_storage client_addr;
|
||||
socklen_t client_len = sizeof(struct sockaddr_storage);
|
||||
|
@ -229,7 +227,7 @@ public:
|
|||
{
|
||||
if (_status != SOCKET_STATUS_CLOSED)
|
||||
{
|
||||
throw Exception("Socket not closed.");
|
||||
throw std::runtime_error("Socket not closed.");
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -311,7 +309,7 @@ public:
|
|||
// Connection request timed out
|
||||
throw SocketException("Connection timed out.");
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
CloseSocket();
|
||||
throw;
|
||||
|
@ -322,7 +320,7 @@ public:
|
|||
{
|
||||
if (_status != SOCKET_STATUS_CLOSED)
|
||||
{
|
||||
throw Exception("Socket not closed.");
|
||||
throw std::runtime_error("Socket not closed.");
|
||||
}
|
||||
|
||||
auto saddress = std::string(address);
|
||||
|
@ -334,9 +332,9 @@ public:
|
|||
{
|
||||
Connect(saddress.c_str(), port);
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
_error = std::string(ex.GetMessage());
|
||||
_error = std::string(ex.what());
|
||||
}
|
||||
barrier2.set_value();
|
||||
}, std::move(barrier));
|
||||
|
@ -355,7 +353,7 @@ public:
|
|||
{
|
||||
if (_status != SOCKET_STATUS_CONNECTED)
|
||||
{
|
||||
throw Exception("Socket not connected.");
|
||||
throw std::runtime_error("Socket not connected.");
|
||||
}
|
||||
|
||||
size_t totalSent = 0;
|
||||
|
@ -377,7 +375,7 @@ public:
|
|||
{
|
||||
if (_status != SOCKET_STATUS_CONNECTED)
|
||||
{
|
||||
throw Exception("Socket not connected.");
|
||||
throw std::runtime_error("Socket not connected.");
|
||||
}
|
||||
|
||||
sint32 readBytes = recv(_socket, (char *)buffer, (sint32)size, 0);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include <stdexcept>
|
||||
#include "../core/IStream.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
#include "../OpenRCT2.h"
|
||||
|
@ -52,7 +53,7 @@ void ImageTable::Read(IReadObjectContext * context, IStream * stream)
|
|||
if (_data == nullptr)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_BAD_IMAGE_TABLE, "Image table too large.");
|
||||
throw Exception();
|
||||
throw std::runtime_error("Image table too large.");
|
||||
}
|
||||
|
||||
// Read g1 element headers
|
||||
|
@ -89,7 +90,7 @@ void ImageTable::Read(IReadObjectContext * context, IStream * stream)
|
|||
|
||||
// TODO validate the image data to prevent crashes in-game
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_BAD_IMAGE_TABLE, "Bad image table.");
|
||||
throw;
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace ObjectFactory
|
|||
// TODO check that ex is really EOF and not some other error
|
||||
context->LogError(OBJECT_ERROR_UNEXPECTED_EOF, "Unexpectedly reached end of file.");
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_UNKNOWN, nullptr);
|
||||
}
|
||||
|
@ -124,10 +124,10 @@ namespace ObjectFactory
|
|||
ReadObjectLegacy(result, &readContext, &chunkStream);
|
||||
if (readContext.WasError())
|
||||
{
|
||||
throw Exception("Object has errors");
|
||||
throw std::runtime_error("Object has errors");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to open or read '%s'", path);
|
||||
|
||||
|
@ -200,7 +200,7 @@ namespace ObjectFactory
|
|||
result = new StexObject(entry);
|
||||
break;
|
||||
default:
|
||||
throw Exception("Invalid object type");
|
||||
throw std::runtime_error("Invalid object type");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ public:
|
|||
SaveObject(path, objectEntry, data, dataSize);
|
||||
ScanObject(path);
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Failed saving object: [%s] to '%s'.", objectName, path);
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ private:
|
|||
Memory::Free(newData);
|
||||
Memory::Free(extraBytes);
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Memory::Free(newData);
|
||||
Memory::Free(extraBytes);
|
||||
|
@ -514,7 +514,7 @@ private:
|
|||
|
||||
Memory::Free(encodedDataBuffer);
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Memory::Free(encodedDataBuffer);
|
||||
throw;
|
||||
|
@ -591,7 +591,7 @@ private:
|
|||
const ObjectRepositoryItem * item = FindObject(entry);
|
||||
if (item == nullptr)
|
||||
{
|
||||
throw Exception(String::StdFormat("Unable to find object '%.8s'", entry->name));
|
||||
throw std::runtime_error(String::StdFormat("Unable to find object '%.8s'", entry->name));
|
||||
}
|
||||
|
||||
// Read object data from file
|
||||
|
@ -599,7 +599,7 @@ private:
|
|||
auto fileEntry = fs.ReadValue<rct_object_entry>();
|
||||
if (!object_entry_compare(entry, &fileEntry))
|
||||
{
|
||||
throw Exception("Header found in object file does not match object to pack.");
|
||||
throw std::runtime_error("Header found in object file does not match object to pack.");
|
||||
}
|
||||
auto chunkReader = SawyerChunkReader(&fs);
|
||||
auto chunk = chunkReader.ReadChunk();
|
||||
|
|
|
@ -80,7 +80,7 @@ void StringTable::Read(IReadObjectContext * context, IStream * stream, uint8 id)
|
|||
_strings.push_back(entry);
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
context->LogError(OBJECT_ERROR_BAD_STRING_TABLE, "Bad string table.");
|
||||
throw;
|
||||
|
|
|
@ -36,7 +36,6 @@ extern "C"
|
|||
}
|
||||
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../rct2/S6Exporter.h"
|
||||
#include "../Version.h"
|
||||
|
||||
|
@ -99,7 +98,7 @@ static bool OnCrash(const wchar_t * dumpPath,
|
|||
exporter->SaveGame(saveFilePathUTF8);
|
||||
savedGameDumped = true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
free(saveFilePathUTF8);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <vector>
|
||||
#include "../core/Collections.hpp"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/FileStream.hpp"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../core/IStream.hpp"
|
||||
|
@ -141,7 +140,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
throw Exception("Invalid RCT1 park extension.");
|
||||
throw std::runtime_error("Invalid RCT1 park extension.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +201,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
throw Exception("Unable to decode park.");
|
||||
throw std::runtime_error("Unable to decode park.");
|
||||
}
|
||||
return ParkLoadResult::CreateOK();
|
||||
}
|
||||
|
@ -1829,7 +1828,7 @@ private:
|
|||
if (object == nullptr && objectType != OBJECT_TYPE_SCENERY_GROUP)
|
||||
{
|
||||
log_error("Failed to load %s.", objectName);
|
||||
throw Exception("Failed to load object.");
|
||||
throw std::runtime_error("Failed to load object.");
|
||||
}
|
||||
|
||||
entryIndex++;
|
||||
|
@ -2746,7 +2745,7 @@ extern "C"
|
|||
s4Importer->Import();
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
delete result;
|
||||
result = new ParkLoadResult(ParkLoadResult::CreateUnknown());
|
||||
|
@ -2766,7 +2765,7 @@ extern "C"
|
|||
s4Importer->Import();
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
delete result;
|
||||
result = new ParkLoadResult(ParkLoadResult::CreateUnknown());
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/IStream.hpp"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
|
@ -48,7 +47,7 @@ void SawyerChunkReader::SkipChunk()
|
|||
auto header = _stream->ReadValue<sawyercoding_chunk_header>();
|
||||
_stream->Seek(header.length, STREAM_SEEK_CURRENT);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
// Rewind stream back to original position
|
||||
_stream->SetPosition(originalPosition);
|
||||
|
@ -79,7 +78,7 @@ std::shared_ptr<SawyerChunk> SawyerChunkReader::ReadChunk()
|
|||
uint8 * buffer = Memory::Allocate<uint8>(bufferSize);
|
||||
if (buffer == nullptr)
|
||||
{
|
||||
throw Exception("Unable to allocate buffer.");
|
||||
throw std::runtime_error("Unable to allocate buffer.");
|
||||
}
|
||||
|
||||
size_t uncompressedLength = DecodeChunk(buffer, bufferSize, compressedData.get(), header);
|
||||
|
@ -87,7 +86,7 @@ std::shared_ptr<SawyerChunk> SawyerChunkReader::ReadChunk()
|
|||
buffer = Memory::Reallocate(buffer, uncompressedLength);
|
||||
if (buffer == nullptr)
|
||||
{
|
||||
throw Exception("Unable to reallocate buffer.");
|
||||
throw std::runtime_error("Unable to reallocate buffer.");
|
||||
}
|
||||
|
||||
return std::make_shared<SawyerChunk>((SAWYER_ENCODING)header.encoding, buffer, uncompressedLength);
|
||||
|
@ -96,7 +95,7 @@ std::shared_ptr<SawyerChunk> SawyerChunkReader::ReadChunk()
|
|||
throw SawyerChunkException(EXCEPTION_MSG_INVALID_CHUNK_ENCODING);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
// Rewind stream back to original position
|
||||
_stream->SetPosition(originalPosition);
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/IStream.hpp"
|
||||
#include "../core/Math.hpp"
|
||||
#include "SawyerChunkWriter.h"
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace SawyerEncoding
|
|||
stream->SetPosition(initialPosition);
|
||||
return checksum == fileChecksum;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
// Rewind back to original position
|
||||
stream->SetPosition(initialPosition);
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/FileStream.hpp"
|
||||
#include "../core/IStream.hpp"
|
||||
#include "../core/String.hpp"
|
||||
|
@ -737,7 +736,7 @@ extern "C"
|
|||
}
|
||||
result = true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
delete s6exporter;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#pragma endregion
|
||||
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/FileStream.hpp"
|
||||
#include "../core/IStream.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
|
@ -50,11 +49,11 @@
|
|||
#include "../world/map_animation.h"
|
||||
#include "../world/Park.h"
|
||||
|
||||
class ObjectLoadException : public Exception
|
||||
class ObjectLoadException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
ObjectLoadException() : Exception("Unable to load objects.") { }
|
||||
explicit ObjectLoadException(const char * message) : Exception(message) { }
|
||||
ObjectLoadException() : std::runtime_error("Unable to load objects.") { }
|
||||
explicit ObjectLoadException(const std::string &message) : std::runtime_error(message) { }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -91,7 +90,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
throw Exception("Invalid RCT2 park extension.");
|
||||
throw std::runtime_error("Invalid RCT2 park extension.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +128,7 @@ public:
|
|||
{
|
||||
if (_s6.header.type != S6_TYPE_SCENARIO)
|
||||
{
|
||||
throw Exception("Park is not a scenario.");
|
||||
throw std::runtime_error("Park is not a scenario.");
|
||||
}
|
||||
chunkReader.ReadChunk(&_s6.info, sizeof(_s6.info));
|
||||
}
|
||||
|
@ -137,7 +136,7 @@ public:
|
|||
{
|
||||
if (_s6.header.type != S6_TYPE_SAVEDGAME)
|
||||
{
|
||||
throw Exception("Park is not a saved game.");
|
||||
throw std::runtime_error("Park is not a saved game.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,7 +817,7 @@ extern "C"
|
|||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
|
||||
|
@ -867,7 +866,7 @@ extern "C"
|
|||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_GAME_SAVE_FAILED;
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
gErrorType = ERROR_TYPE_FILE_LOAD;
|
||||
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
|
||||
|
|
|
@ -225,7 +225,7 @@ private:
|
|||
result = true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
|
@ -249,7 +249,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to read scenario: '%s'", path.c_str());
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ private:
|
|||
highscore->timestamp = fs.ReadValue<datetime64>();
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Error reading highscores.");
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Error reading legacy scenario scores file: '%s'", path.c_str());
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ private:
|
|||
fs.WriteValue(highscore->timestamp);
|
||||
}
|
||||
}
|
||||
catch (const Exception &)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to save highscores to '%s'", path.c_str());
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ extern "C"
|
|||
}
|
||||
catch (const IOException& exception)
|
||||
{
|
||||
Console::Error::WriteLine(exception.GetMessage());
|
||||
Console::Error::WriteLine(exception.what());
|
||||
}
|
||||
|
||||
if (fileStream != nullptr)
|
||||
|
@ -208,7 +208,7 @@ extern "C"
|
|||
fs.Write(script, String::SizeOf(script));
|
||||
success = true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -255,9 +255,9 @@ extern "C"
|
|||
delete zip;
|
||||
Memory::Free(fdata);
|
||||
}
|
||||
catch (const Exception &ex)
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
Console::Error::WriteLine(ex.GetMessage());
|
||||
Console::Error::WriteLine(ex.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -580,7 +580,7 @@ static void * ReadScriptFile(const utf8 * path, size_t * outSize)
|
|||
buffer = Memory::Allocate<void>(size);
|
||||
fs.Read(buffer, size);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Memory::Free(buffer);
|
||||
buffer = nullptr;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "../common.h"
|
||||
#include "../Context.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Exception.hpp"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
|
@ -180,7 +179,7 @@ public:
|
|||
{
|
||||
if (targetPosition < 0 || targetPosition >= (sint32)_sequence->NumCommands)
|
||||
{
|
||||
throw Exception("Invalid position.");
|
||||
throw std::runtime_error("Invalid position.");
|
||||
}
|
||||
if (_position >= targetPosition)
|
||||
{
|
||||
|
@ -421,7 +420,7 @@ private:
|
|||
PrepareParkForPlayback();
|
||||
success = true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to load park: %s", path);
|
||||
}
|
||||
|
@ -456,7 +455,7 @@ private:
|
|||
PrepareParkForPlayback();
|
||||
success = true;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (const std::exception &)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to load park: %s", hintPath.c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue