1 // Copyright 2015-present 650 Industries. All rights reserved. 2 package host.exp.exponent.kernel 3 4 import android.os.Bundle 5 import org.json.JSONException 6 import org.json.JSONObject 7 import java.util.* 8 9 class ExponentError( 10 val errorMessage: ExponentErrorMessage, 11 val errorHeader: String?, 12 val stack: Array<Bundle>, 13 val exceptionId: Int, 14 val isFatal: Boolean 15 ) { 16 val timestamp: Date = Calendar.getInstance().time 17 toJSONObjectnull18 fun toJSONObject(): JSONObject? { 19 return try { 20 JSONObject().apply { 21 put("errorHeader", errorHeader) 22 put("errorMessage", errorMessage.developerErrorMessage()) 23 put("exceptionId", exceptionId) 24 put("isFatal", isFatal) 25 } 26 } catch (e: JSONException) { 27 null 28 } 29 } 30 } 31