CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
DataPortalErrorInfo.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="HttpErrorInfo.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Message containing details about any</summary>
7//-----------------------------------------------------------------------
8
9using System;
10
12{
18 public class DataPortalErrorInfo : ReadOnlyBase<DataPortalErrorInfo>
19 {
23 public static readonly PropertyInfo<string> ExceptionTypeNameProperty = RegisterProperty<string>(c => c.ExceptionTypeName);
24
28 public string ExceptionTypeName
29 {
31 private set { LoadProperty(ExceptionTypeNameProperty, value); }
32 }
33
37 public static readonly PropertyInfo<string> MessageProperty = RegisterProperty<string>(c => c.Message);
38
42 public string Message
43 {
44 get { return GetProperty(MessageProperty); }
45 private set { LoadProperty(MessageProperty, value); }
46 }
47
51 public static readonly PropertyInfo<string> StackTraceProperty = RegisterProperty<string>(c => c.StackTrace);
52
56 public string StackTrace
57 {
58 get { return GetProperty(StackTraceProperty); }
59 private set { LoadProperty(StackTraceProperty, value); }
60 }
61
65 public static readonly PropertyInfo<string> SourceProperty = RegisterProperty<string>(c => c.Source);
66
70 public string Source
71 {
72 get { return GetProperty(SourceProperty); }
73 private set { LoadProperty(SourceProperty, value); }
74 }
75
79 public static readonly PropertyInfo<string> TargetSiteNameProperty = RegisterProperty<string>(c => c.TargetSiteName);
80
84 public string TargetSiteName
85 {
86 get { return GetProperty(TargetSiteNameProperty); }
87 private set { LoadProperty(TargetSiteNameProperty, value); }
88 }
89
95 public static readonly PropertyInfo<DataPortalErrorInfo> InnerErrorProperty = RegisterProperty<DataPortalErrorInfo>(c => c.InnerError);
96
103 {
104 get { return GetProperty(InnerErrorProperty); }
105 private set { LoadProperty(InnerErrorProperty, value); }
106 }
107
114 public DataPortalErrorInfo(Exception ex)
115 {
116 this.ExceptionTypeName = ex.GetType().FullName;
117 this.Message = ex.Message;
118 this.StackTrace = ex.StackTrace;
119#if !(ANDROID || IOS)
120 this.Source = ex.Source;
121#endif
122 if (ex.InnerException != null)
123 this.InnerError = new DataPortalErrorInfo(ex.InnerException);
124 }
125
130 { }
131
132#if !NETSTANDARD2_0 && !NET5_0
139 {
140 var errorInfo = this;
141 var source = info;
142 while (source != null)
143 {
144 errorInfo.Message = source.Message;
145 errorInfo.ExceptionTypeName = source.ExceptionTypeName;
146 errorInfo.Source = source.Source;
147 errorInfo.StackTrace = source.StackTrace;
148 errorInfo.TargetSiteName = source.TargetSiteName;
149 source = source.InnerError;
150 if (source != null)
151 {
152 errorInfo.InnerError = new DataPortalErrorInfo();
153 errorInfo = errorInfo.InnerError;
154 }
155 }
156 }
157#endif
158 }
159}
Maintains metadata about a property.
This is a base class from which readonly business classes can be derived.
virtual void LoadProperty(IPropertyInfo propertyInfo, object newValue)
Loads a property's managed field with the supplied value calling PropertyHasChanged if the value does...
object GetProperty(IPropertyInfo propertyInfo)
Gets a property's value as a specified type.
Message containing details about any server-side exception.
static readonly PropertyInfo< string > StackTraceProperty
Stack trace from the exception object.
static readonly PropertyInfo< string > TargetSiteNameProperty
TargetSiteName of the exception object.
static readonly PropertyInfo< DataPortalErrorInfo > InnerErrorProperty
HttpErrorInfo object containing information about any inner exception of the original exception.
static readonly PropertyInfo< string > MessageProperty
Message from the exception object.
static readonly PropertyInfo< string > ExceptionTypeNameProperty
Type name of the exception object.
DataPortalErrorInfo(Exception ex)
Creates an instance of the object.
string ExceptionTypeName
Type name of the exception object.
string TargetSiteName
TargetSiteName of the exception object.
DataPortalErrorInfo()
Creates an empty instance of the type.
string Message
Message from the exception object.
DataPortalErrorInfo(Csla.WcfPortal.WcfErrorInfo info)
Creates an instance of the type by copying the WcfErrorInfo data.
static readonly PropertyInfo< string > SourceProperty
Source of the exception object.
DataPortalErrorInfo InnerError
HttpErrorInfo object containing information about any inner exception of the original exception.
string StackTrace
Stack trace from the exception object.
@ Serializable
Prevents updating or inserting until the transaction is complete.