Optick: Add support for reporting runtime errors with text descriptions

(cherry picked from commit a743dfb54554a9524e47471b138e4a757e92cb6c)
This commit is contained in:
Stephen Saunders 2024-01-16 23:39:24 -05:00
parent 62e9c561d5
commit 4e30cdce06
2 changed files with 6 additions and 4 deletions

View file

@ -33,6 +33,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdexcept>
#if defined(OPTICK_MSVC)
@ -143,11 +144,12 @@ static const ProcessID INVALID_PROCESS_ID = (ProcessID)-1;
#ifdef _DEBUG
#define OPTICK_ASSERT(arg, description) if (!(arg)) { OPTICK_DEBUG_BREAK; }
#define OPTICK_FAILED(description) { OPTICK_DEBUG_BREAK; }
#define OPTICK_VERIFY(arg, description, operation) if (!(arg)) { OPTICK_DEBUG_BREAK; operation; }
#else
#define OPTICK_ASSERT(arg, description)
#define OPTICK_FAILED(description)
#define OPTICK_FAILED(description) { throw std::runtime_error(description); }
#define OPTICK_VERIFY(arg, description, operation) if (!(arg)) { OPTICK_FAILED(description); operation; }
#endif
#define OPTICK_VERIFY(arg, description, operation) if (!(arg)) { OPTICK_DEBUG_BREAK; operation; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -289,7 +289,7 @@ Server::Server(short port) : socket(Memory::New<Socket>()), saveCb(nullptr)
{
if (!socket->Bind(port, 4))
{
OPTICK_FAILED("Failed to bind a socket! Most probably the port is blocked by anti-virus! Change the port and verify that your game has enough permissions to communicate over the TCP\IP.");
OPTICK_FAILED("Failed to bind a socket! Most probably the port is blocked by anti-virus! Change the port and verify that your game has enough permissions to communicate over the TCP/IP.");
}
else
{
@ -499,4 +499,4 @@ Server & Server::Get()
}
#endif //USE_OPTICK
#endif //USE_OPTICK