diff options
author | crupest <crupest@outlook.com> | 2020-06-13 00:28:35 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-13 00:28:35 +0800 |
commit | eba8e9698c09b805d8ac2a8f58db93b947ac29e3 (patch) | |
tree | c3bf0aef9d80c19e9a71e9e9aaab16b8364db15b /Timeline/Services/Exceptions/UserNotExistException.cs | |
parent | cc62df19e5f8aa216660915f46ff290c8eeab1d0 (diff) | |
download | timeline-eba8e9698c09b805d8ac2a8f58db93b947ac29e3.tar.gz timeline-eba8e9698c09b805d8ac2a8f58db93b947ac29e3.tar.bz2 timeline-eba8e9698c09b805d8ac2a8f58db93b947ac29e3.zip |
refactor(back): Fix #100 .
Diffstat (limited to 'Timeline/Services/Exceptions/UserNotExistException.cs')
-rw-r--r-- | Timeline/Services/Exceptions/UserNotExistException.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Timeline/Services/Exceptions/UserNotExistException.cs b/Timeline/Services/Exceptions/UserNotExistException.cs new file mode 100644 index 00000000..7ef714df --- /dev/null +++ b/Timeline/Services/Exceptions/UserNotExistException.cs @@ -0,0 +1,40 @@ +using System;
+using System.Globalization;
+
+namespace Timeline.Services.Exceptions
+{
+ /// <summary>
+ /// The user requested does not exist.
+ /// </summary>
+ [Serializable]
+ public class UserNotExistException : EntityNotExistException
+ {
+ public UserNotExistException() : this(null, null, null, null) { }
+ public UserNotExistException(string? username, Exception? inner) : this(username, null, null, inner) { }
+
+ public UserNotExistException(string? username) : this(username, null, null, null) { }
+
+ public UserNotExistException(long id) : this(null, id, null, null) { }
+
+ public UserNotExistException(string? username, long? id, string? message, Exception? inner) : base(EntityNames.User, null,
+ string.Format(CultureInfo.InvariantCulture, Resources.Services.Exceptions.UserNotExistException, username ?? "", id).AppendAdditionalMessage(message), inner)
+ {
+ Username = username;
+ Id = id;
+ }
+
+ protected UserNotExistException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
+
+ /// <summary>
+ /// The username of the user that does not exist.
+ /// </summary>
+ public string? Username { get; set; }
+
+ /// <summary>
+ /// The id of the user that does not exist.
+ /// </summary>
+ public long? Id { get; set; }
+ }
+}
|