1. A computer-implemented method, comprising: determining, by a processor, that an event has been triggered during execution of a program, wherein the program includes: an error context generating an error message in a formatting when a first error is detected during execution of the program and an error buffer storing the generated error message; executing, by the processor, a first registered event handler associated with the event in response to the determination, wherein the first registered event handler includes: a first local error context generating a first local error message when a second error is detected during execution of the first registered event handler and a first local error buffer storing the first local error message, and wherein the first registered event handler copies the error context to the first local error context during initialization of the first registered event handler so that the formatting is applied to error messages generated during execution of the first registered event handler and error messages generated during execution of the program; and merging, by the processor, the first local error buffer into the error buffer.