-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_exceptions.cs
29 lines (28 loc) · 974 Bytes
/
custom_exceptions.cs
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
using System;
using System.IO;
using System.Runtime.Serialization;
namespace Custom_Exceptions
{
class Program
{
static void Main(string[] args)
{
//throw new FileNotFoundException("File not XYZ is not found");
try
{
throw new UserAlreadyLoggedInException("User already logged in");
}catch (UserAlreadyLoggedInException e)
{
Console.WriteLine(e.Message);
}
}
}
[Serializable]
public class UserAlreadyLoggedInException : Exception
{
public UserAlreadyLoggedInException() : base() { }
public UserAlreadyLoggedInException(string meesage) : base(meesage) { }
public UserAlreadyLoggedInException(string message, Exception innerException) : base(message, innerException) { }
public UserAlreadyLoggedInException(SerializationInfo info, StreamingContext contect) : base(info, contect) { }
}
}