In my code I have an ERROR
macro defined that I've been using to report fatal errors like nonrecoverable allocation failures, assumptions not being met, etc. It's defined like so (initializing pd
is the first thing done in the kEventInit
callback):
extern const PlaydateAPI *pd;
// ...
#define ERROR_FMT(fmt, ...) pd->system->error("%s:%zu(%s): " fmt, __FILE__, __LINE__, __func__, __VA_ARGS__)
// since there's no portable way to have a variadic macro where the varargs are optional
#define ERROR(msg) ERROR_FMT("%s", msg)
When I first wrote it using pd->system->error
I assumed it would function the same as when an error occurs in Lua code—i.e. on the simulator it's paused and on the device it crashes with a useful error screen—since that's approximately what's described by the documentation:
Calls the log function, outputting an error in red to the console, then pauses execution.
— Inside Playdate with C: playdate->system->error
However, while it does output an error in red to the console, it doesn't do anything other than that on the simulator. I've tested it in both the init code run in eventHandler
on kEventInit
and in my update
callback and in no situation is it paused.