chore: 将 LCException 提到 LeanCloud 命名空间下,并增加 ToString()

oneRain 2020-05-21 10:41:58 +08:00
parent 3e8e6b5f18
commit 86cf1eada2
5 changed files with 19 additions and 5 deletions

View File

@ -30,6 +30,9 @@
<Compile Include="..\Common\Json\LCJsonConverter.cs">
<Link>Json\LCJsonConverter.cs</Link>
</Compile>
<Compile Include="..\Common\Exception\LCException.cs">
<Link>Exception\LCException.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">

View File

@ -13,5 +13,6 @@
<Folder Include="Log\" />
<Folder Include="Http\" />
<Folder Include="Task\" />
<Folder Include="Exception\" />
</ItemGroup>
</Project>

View File

@ -1,11 +1,20 @@
using System;
namespace LeanCloud.Storage {
namespace LeanCloud {
/// <summary>
/// LeanCloud 异常
/// </summary>
public class LCException : Exception {
/// <summary>
/// 错误码
/// </summary>
public int Code {
get; set;
}
/// <summary>
/// 错误信息
/// </summary>
public new string Message {
get; set;
}
@ -14,5 +23,9 @@ namespace LeanCloud.Storage {
Code = code;
Message = message;
}
public override string ToString() {
return $"{Code} - {Message}";
}
}
}

View File

@ -15,9 +15,6 @@
<Compile Include="..\Storage\LCCloud.cs">
<Link>LCCloud.cs</Link>
</Compile>
<Compile Include="..\Storage\LCException.cs">
<Link>LCException.cs</Link>
</Compile>
<Compile Include="..\Storage\LCFile.cs">
<Link>LCFile.cs</Link>
</Compile>

View File

@ -1,5 +1,5 @@
using NUnit.Framework;
using LeanCloud.Storage;
using LeanCloud;
namespace Storage.Test {
public class ExceptionTest {