Files
Horizon-OC/Source/sys-clk-OC/sysmodule/src/errors.h
KazushiM cf6ef64d99 No binaries released for now:
- [Sys-clk-OC] Add permanent override for overlay and manager, will add more toggles later and therefore deprecates InfoNX

- [MEM] Replace 1331 MHz table with 1600 MHz (idea by 3DSBricker)

- [MEM] Add more info on SDRAM and tips for timing calculation
2021-12-21 22:52:32 +08:00

37 lines
1.4 KiB
C++

/*
* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
#pragma once
#include <switch.h>
#include <stdexcept>
#ifdef DEBUG
#define ERROR_THROW(format, ...) Errors::ThrowException(format "\n in %s:%u", ##__VA_ARGS__, __FILE__, __LINE__)
#else
#define ERROR_THROW(format, ...) Errors::ThrowException(format, ##__VA_ARGS__)
#endif
#define ERROR_RESULT_THROW(rc, format, ...) ERROR_THROW(format "\n RC: [0x%x] %04d-%04d", ##__VA_ARGS__, rc, R_MODULE(rc), R_DESCRIPTION(rc))
#define ASSERT_RESULT_OK(rc, format, ...) \
if (R_FAILED(rc)) \
{ \
ERROR_RESULT_THROW(rc, "ASSERT_RESULT_OK: " format, ##__VA_ARGS__); \
}
class Errors
{
public:
static void ThrowException(const char *format, ...);
protected:
static const char *FormatMessage(const char *format, va_list args);
};