/// <summary> /// Transforms the exception in a Fetch, Create or Execute method. /// </summary> /// <param name="objectType">Type of the object.</param> /// <param name="criteria">The criteria.</param> /// <param name="methodName">Name of the method.</param> /// <param name="ex">The exception.</param> /// <returns></returns> public Exception InspectException(Type objectType, object criteria, string methodName, Exception ex) { Exception handledException; if (ex is CallMethodException) { if (CallExceptionInspector(objectType, null, criteria, methodName, ex.InnerException, out handledException)) { ex = new CallMethodException(methodName + " " + Resources.MethodCallFailed, handledException); } } else { if (CallExceptionInspector(objectType, null, criteria, methodName, ex, out handledException)) { ex = handledException; } } return ex; }
/// <summary> /// Transforms the exception in a Update, Delete method /// </summary> /// <param name="objectType">Type of the object.</param> /// <param name="businessObject">The business object if available.</param> /// <param name="criteria">The criteria.</param> /// <param name="methodName">Name of the method.</param> /// <param name="ex">The exception.</param> /// <returns></returns> public Exception InspectException(Type objectType, object businessObject, object criteria, string methodName, Exception ex) { // The exception as parameter is always a CallMethodException containing the business exception as Inner exception Exception handledException; if (ex is CallMethodException) { if (CallExceptionInspector(objectType, businessObject, criteria, methodName, ex.InnerException, out handledException)) { // developer should only transform and if rethrows a new we will wrap as new CallMethodException ex = new Csla.Reflection.CallMethodException(methodName + " " + Resources.MethodCallFailed, handledException); } } else { if (CallExceptionInspector(objectType, null, criteria, methodName, ex, out handledException)) { ex = handledException; } } return(ex); }
/// <summary> /// Transforms the exception in a Update, Delete method /// </summary> /// <param name="objectType">Type of the object.</param> /// <param name="businessObject">The business object if available.</param> /// <param name="criteria">The criteria.</param> /// <param name="methodName">Name of the method.</param> /// <param name="ex">The exception.</param> /// <returns></returns> public Exception InspectException(Type objectType, object businessObject, object criteria, string methodName, Exception ex) { // The exception as parameter is always a CallMethodException containing the business exception as Inner exception Exception handledException; if (ex is CallMethodException) { if (CallExceptionInspector(objectType, businessObject, criteria, methodName, ex.InnerException, out handledException)) { // developer should only transform and if rethrows a new we will wrap as new CallMethodException ex = new Csla.Reflection.CallMethodException(methodName + " " + Resources.MethodCallFailed, handledException); } } else { if (CallExceptionInspector(objectType, null, criteria, methodName, ex, out handledException)) { ex = handledException; } } return ex; }