I would find something where I can make programmatic decisions based on the general class of error, e.g. "was a client side problem" "was a cache related problem" "was an origin connection problem" "was a protocol violation" most useful. While also being able to get the specific error values. To me that implies an API, although if the strings in special headers were of a standard format that included that sort of info you could get the same results that way.
-William Bardwell