I don't think the error trap handler receives any information about the precise error which caused it to run. You can get the exit code from the failed command, but by the time the trap runs, you don't know even which command failed.
You could try to write a simple C program to fetch the latest system error with perror
or some such.
... Update: It doesn't work; in retrospect, for obvious reasons. I'll leave this here for coming generations to discover. /-:
vnix$ cat perror.c
#include <stdio.h>
#include <errno.h>
int main (int argc, char **argv)
{
perror("");
}
vnix$ gcc perror.c
vnix$ touch /fnord
touch: cannot touch `/fnord': Permission denied
vnix$ ./a.out
Success