Example #1
0
 /// <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)
 {
     this.Key = key;
     this.CreatedStamp = createdStamp;
     this.Scene = scene;
     this.Code = code;
     this.OperatorCredential = operatorCredential as BaseCredential;
     this.ReferenceData = data;
     this.Hint = hint;
 }
Example #2
0
        /// <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)
        {
            this.Code = code;
            this.OperatorCredential = ContextHelper.CurrentCredential;
            this.ReferenceData = data == null ? null : JToken.FromObject(data);
            this.Scene = scene;
            this.CreatedStamp = DateTime.UtcNow;

            var inner = innerException as BaseException;
            this.Key = inner == null ? Guid.NewGuid() : inner.Key;
            this.Hint = hint ?? inner?.Hint;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceNotFoundException" /> 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 ResourceNotFoundException(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>
 /// Initializes a new instance of the <see cref="SqlStoredProcedureException"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="exceptionCode">The exception code.</param>
 internal SqlStoredProcedureException(string message, ExceptionCode exceptionCode)
     : base(message, exceptionCode)
 {
 }