I just went with:
trap 'echo "${BASH_SOURCE[0]##*/}: exit status: $?"' EXIT
But the problem is more generic, obviously.