1. A system, comprising: a processor; and a memory comprising program instructions, wherein the program instructions are executable by the processor to implement: in each of two or more threads of a multithreaded program, for each error generated by one or more functions executed in the thread, store an error trace element in thread private data of the respective thread, wherein the error trace element is stored by the thread to the respective thread private data in accordance with an application programming interface (API) to an error trace mechanism, and wherein the thread private data is a memory storage area of the multithreaded program accessible by the respective thread but not by others of the two or more threads; and in a function of the multithreaded program, obtain an error trace for each of the two or more threads of the multithreaded program, wherein an error trace for a thread is obtained from the respective thread in accordance with the API to the error trace mechanism; wherein each error trace includes one or more error trace elements from the thread private data of the respective thread, wherein each error trace element includes a plurality of fields describing a particular error generated during execution of the respective thread.