/// <summary> /// Initializes a new instance of the <see cref="BaseException" /> class. This is used internally for restoring exception instance from ExceptionInfo. /// </summary> /// <param name="key">The key.</param> /// <param name="createdStamp">The created stamp.</param> /// <param name="message">The message.</param> /// <param name="scene">The scene.</param> /// <param name="code">The code.</param> /// <param name="innerException">The inner exception.</param> /// <param name="operatorCredential">The operator credential.</param> /// <param name="data">The data.</param> /// <param name="hint">The hint.</param> protected BaseException(Guid key, DateTime createdStamp, string message, ExceptionScene scene, ExceptionCode code, Exception innerException, BaseCredential operatorCredential, JToken data, FriendlyHint hint) : base(message, innerException) { Key = key; CreatedStamp = createdStamp; Scene = scene; Code = code; OperatorCredential = operatorCredential as BaseCredential; ReferenceData = data; Hint = hint; }
/// <summary> /// Initializes a new instance of the <see cref="BaseException" /> class. /// </summary> /// <param name="message">The exception message.</param> /// <param name="code">The exception code.</param> /// <param name="innerException">The inner exception.</param> /// <param name="data">The data.</param> /// <param name="hint">The hint.</param> /// <param name="scene">The scene.</param> protected BaseException(string message, ExceptionCode code, Exception innerException = null, object data = null, FriendlyHint hint = null, ExceptionScene scene = null) : base(message, innerException) { Code = code; OperatorCredential = Framework.GetCurrentOperatorCredential?.Invoke(); ReferenceData = data == null ? null : JToken.FromObject(data); Scene = scene; CreatedStamp = DateTime.UtcNow; var inner = innerException as BaseException; Key = inner == null?Guid.NewGuid() : inner.Key; Hint = hint ?? inner?.Hint; }
/// <summary> /// Initializes a new instance of the <see cref="InitializationFailureException" /> class. /// </summary> /// <param name="key">The key.</param> /// <param name="createdStamp">The created stamp.</param> /// <param name="message">The message.</param> /// <param name="scene">The scene.</param> /// <param name="code">The code.</param> /// <param name="innerException">The inner exception.</param> /// <param name="operatorCredential">The operator credential.</param> /// <param name="data">The data.</param> /// <param name="hint">The hint.</param> internal InitializationFailureException(Guid key, DateTime createdStamp, string message, ExceptionScene scene, ExceptionCode code, Exception innerException, BaseCredential operatorCredential, JToken data, FriendlyHint hint) : base(key, createdStamp, message, scene, code, innerException, operatorCredential, data, hint) { }
/// <summary> /// Determines whether the specified <see cref="System.Object" /> is equal to this instance. /// </summary> /// <param name="obj">Another object to compare to.</param> /// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns> public override bool Equals(object obj) { ExceptionCode exceptionCode = obj as ExceptionCode; return(exceptionCode != null && exceptionCode.Major == Major && exceptionCode.Minor.SafeToString() == Minor.SafeToString()); }