Possible to write to flash in the app error handler?

What would be the best way to store configuration and fault information in flash when the app_error_handler is called?  It seems like all the libraries available are purely async so I don't know if they would work for me.