The problem with `getlasterror` and `errno` is that they're global (thread-local, whatever).
But if you make them take a `context` object, there's no longer a problem.
One interesting observation - you can use them even for the initial "failed to allocate a context" by interpreting a NULL pointer as always containing an "out of memory" error.