aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/EntityAlreadyExistException.cs
blob: 2d3de36845a9015b44a6f9b9fee8800f61f6bea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;

namespace Timeline.Services
{
    /// <summary>
    /// Thrown when an entity is already exists.
    /// </summary>
    /// <remarks>
    /// For example, want to create a timeline but a timeline with the same name already exists.
    /// </remarks>
    [Serializable]
    public class EntityAlreadyExistException : Exception
    {
        public EntityAlreadyExistException() : this(null, null, null, null) { }
        public EntityAlreadyExistException(string? entityName) : this(entityName, null, null, null) { }
        public EntityAlreadyExistException(string? entityName, Exception? inner) : this(entityName, null, null, inner) { }
        public EntityAlreadyExistException(string? entityName, object? entity, Exception inner) : this(entityName, entity, null, inner) { }
        public EntityAlreadyExistException(string? entityName, object? entity, string? message, Exception? inner) : base(message ?? Resource.ExceptionEntityAlreadyExist, inner)
        {
            EntityName = entityName;
            Entity = entity;
        }

        protected EntityAlreadyExistException(
          System.Runtime.Serialization.SerializationInfo info,
          System.Runtime.Serialization.StreamingContext context) : base(info, context) { }

        public string? EntityName { get; }

        public object? Entity { get; }
    }
}