Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Response"/> class as a failure response.
        /// </summary>
        /// <param name="exception">The error that occurred</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="exception"/> is a null reference.</exception>
        public Response(Exception exception)
            : base()
        {
            if (exception == null) {
                throw new ArgumentNullException("exception");
            }

            this._error = new ServiceError(exception);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Response"/> class as a failure response.
        /// </summary>
        /// <param name="error">The error that occurred.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="error"/>is a null reference.</exception>
        public Response(ServiceError error)
            : base()
        {
            if (error == null) {
                throw new ArgumentNullException("error");
            }

            this._error = error;
        }
Exemplo n.º 3
0
        // Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="T:ServiceError"/> class.
        /// </summary>
        /// <param name="exception">The exception to wrap.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="exception"/> is a null reference.</exception>
        public ServiceError(Exception exception)
            : base()
        {
            if (exception == null) {
                throw new ArgumentNullException("exception");
            }

            this._className = exception.GetType().Name;
            this._typeName = exception.GetType().FullName;
            this._message = exception.Message;
            this._stackTrace = exception.StackTrace;
            this._data = exception.Data;
            this._hResult = (Int32)exception.GetPropertyValue("HResult");
            this._innerError = exception.InnerException != null ? new ServiceError(exception.InnerException) : null;
        }