The Application-Died Event
If an application launched by your application terminates, either normally or
by sending it an Apple event-the Application Died event. To receive this
notification, you must set the acceptAppDiedEvents flag in your application's
'SIZE' resource. The Application Died event has an event class of
kCoreEventClass and an event id of kAEApplicationDied.
from the system global variable DSErrCode. This value can be set either by the
application before it terminates or by the Operating System (which can occur
as the result of a hardware exception or other problem).