diff options
author | crupest <crupest@outlook.com> | 2021-04-25 21:20:04 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-04-25 21:20:04 +0800 |
commit | a4a75188bd17e31b39a02511bbd6d628bab5c909 (patch) | |
tree | f2f9c63eb5beabb7a1a2f2605c2d5022f6a72c08 /BackEnd/Timeline/Services/EntityAlreadyExistException.cs | |
parent | 434be212c77bdade04722046e92c3dac25d0aff3 (diff) | |
download | timeline-a4a75188bd17e31b39a02511bbd6d628bab5c909.tar.gz timeline-a4a75188bd17e31b39a02511bbd6d628bab5c909.tar.bz2 timeline-a4a75188bd17e31b39a02511bbd6d628bab5c909.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Services/EntityAlreadyExistException.cs')
-rw-r--r-- | BackEnd/Timeline/Services/EntityAlreadyExistException.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Services/EntityAlreadyExistException.cs b/BackEnd/Timeline/Services/EntityAlreadyExistException.cs new file mode 100644 index 00000000..2d3de368 --- /dev/null +++ b/BackEnd/Timeline/Services/EntityAlreadyExistException.cs @@ -0,0 +1,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; }
+ }
+}
|