| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using Quadarax.Foundation.Core.Exceptions;
- namespace Quadarax.Foundation.Core.Data.Interface.Entity.Dto
- {
- public class ErrorMessageDto : IDto, IError
- {
- /// <summary>
- /// <inheritdoc cref="IError.Message"/>
- /// </summary>
- public string Message { get; set; }
- /// <summary>
- /// <inheritdoc cref="IError.Code"/>
- /// </summary>
- public int Code { get; set; }
- public string CallStack { get; set; }
- public ErrorMessageDto(){}
- public ErrorMessageDto(Exception exception, int code)
- {
- if (exception==null)
- throw new ArgumentNullException(nameof(exception));
- Message = exception.Message;
- Code = code;
- CallStack = exception.StackTrace;
- }
- public ErrorMessageDto(Exception exception)
- {
- if (exception==null)
- throw new ArgumentNullException(nameof(exception));
- Message = exception.Message;
- Code = exception.GetCode();
- CallStack = exception.StackTrace;
- }
- }
- }
|