| 123456789101112131415161718192021222324252627282930313233343536 |
- 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 ErrorMessageDto(){}
- public ErrorMessageDto(Exception exception, int code)
- {
- if (exception==null)
- throw new ArgumentNullException(nameof(exception));
- Message = exception.Message;
- Code = code;
- }
- public ErrorMessageDto(CodeException exception)
- {
- if (exception==null)
- throw new ArgumentNullException(nameof(exception));
- Message = exception.Message;
- Code = exception.GetCode();
- }
- }
- }
|