mirror of
https://github.com/sochix/TLSharp.git
synced 2026-01-20 15:40:31 +01:00
Create common abstract DataCenterMigrationException
We can abstract the DC property to a common abstract class so have a bit of less code and we join these 3 classes together semantically.
This commit is contained in:
parent
c1305ada65
commit
a521466bb0
|
|
@ -495,36 +495,37 @@ namespace TLSharp.Core.Network
|
|||
}
|
||||
}
|
||||
|
||||
internal class PhoneMigrationException : Exception
|
||||
internal abstract class DataCenterMigrationException : Exception
|
||||
{
|
||||
internal int DC { get; private set; }
|
||||
|
||||
protected DataCenterMigrationException(string msg, int dc) : base (msg)
|
||||
{
|
||||
DC = dc;
|
||||
}
|
||||
}
|
||||
|
||||
internal class PhoneMigrationException : DataCenterMigrationException
|
||||
{
|
||||
internal PhoneMigrationException(int dc)
|
||||
: base ($"Your phone number is registered to a different DC: {dc}. Please migrate.")
|
||||
: base ($"Your phone number is registered to a different DC: {dc}. Please migrate.", dc)
|
||||
{
|
||||
DC = dc;
|
||||
}
|
||||
}
|
||||
|
||||
internal class FileMigrationException : Exception
|
||||
internal class FileMigrationException : DataCenterMigrationException
|
||||
{
|
||||
internal int DC { get; private set; }
|
||||
|
||||
internal FileMigrationException(int dc)
|
||||
: base ($"File is located on a different DC: {dc}. Please migrate.")
|
||||
: base ($"File is located on a different DC: {dc}. Please migrate.", dc)
|
||||
{
|
||||
DC = dc;
|
||||
}
|
||||
}
|
||||
|
||||
internal class UserMigrationException : Exception
|
||||
internal class UserMigrationException : DataCenterMigrationException
|
||||
{
|
||||
internal int DC { get; private set; }
|
||||
|
||||
internal UserMigrationException(int dc)
|
||||
: base($"User is located on a different DC: {dc}. Please migrate.")
|
||||
: base($"User is located on a different DC: {dc}. Please migrate.", dc)
|
||||
{
|
||||
DC = dc;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue