replace stack trace with messages for exception handling