0 Replies Latest reply on Nov 6, 2007 11:30 AM by sanclementetech

    How to Parse FaultEvent

    sanclementetech
      Hi all -

      I am getting an error message and would like to parse out just the error message instead of the whole message body. Here is the complete out put from event.message.toString().

      =======================START===============================
      (mx.messaging.messages::ErrorMessage)#0
      body = (null)
      clientId = "ECB58CC2-D80E-EAD9-9064-DE0EE37F83F2"
      correlationId = "929F8C33-AD86-CFE8-0D0B-1668AC4E1A79"
      destination = "contact.hibernate"
      extendedData = (null)
      faultCode = "Server.Processing"
      faultDetail = (null)
      faultString = "Could not invoke sync method on data adapter for destination 'contact.hibernate' due to the following error: class org.hibernate.exception.ConstraintViolationException:could not insert: [com.circortech.hibernate.Contact]."
      headers = (Object)#1
      messageId = "ECB58D1D-2D0F-0010-5251-FF4DBBFF2543"
      rootCause = (Object)#2
      cause = (Object)#3
      cause = (null)
      errorCode = 1062
      localizedMessage = "Duplicate entry 'ken@sanclementetech.com' for key 2"
      message = "Duplicate entry 'ken@sanclementetech.com' for key 2"
      nextException = (null)
      SQLState = "23000"
      constraintName = (null)
      errorCode = 1062
      localizedMessage = "could not insert: [com.circortech.hibernate.Contact]"
      messages = (Array)#4
      [0] "could not insert: [com.circortech.hibernate.Contact]"
      [1] "Duplicate entry 'ken@sanclementetech.com' for key 2"
      SQL = "insert into contact (name_title_id, name_suffix_id, work_email, first_name, last_name, created_by, created_date, middle_initial, screen_name, modified_date, modified_by, passwd, nickname, birthday, anniversary, work_address_1, work_address_2, work_city, work_country, work_postal_code, work_phone, work_phone_ext, work_fax, work_pager, work_mobile, work_phone_other, work_website, picture_filename, other_interests, job_title, send_email, email_format) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
      SQLException = (Object)#3
      SQLState = "23000"
      throwableCount = 2
      throwables = (Array)#5
      [0] (Object)#2
      [1] (Object)#3
      timestamp = 1194376866941
      timeToLive = 0
      =========================END===============================

      I would like to get the rootCause.messages. Any ideas?