While the lua api has automatic stack traces being logged to disk, the C api might do the same by writing the argument that is passed to playdate->system->error to file and then entering a state where the player can flip between the last screen buffer and an on-screen display of the same argument.
The caller will be responsible for formatting that output in such a way that it is most useful for troubleshooting; probably by constructing a stacktrace.
This won't help with segfaults, but there might be catchable fatal errors that could be logged this way