chore: LCException

oneRain 2021-03-22 17:06:12 +08:00
parent b5980c839c
commit 4bb16ce423
2 changed files with 10 additions and 3 deletions

View File

@ -47,8 +47,8 @@ namespace LeanCloud.Engine {
object result = await LCEngine.Invoke(mi, req);
if (result != null) {
return new Dictionary<string, object> {
{ "result", result }
};
{ "result", result }
};
}
}
return default;

View File

@ -213,7 +213,14 @@ namespace LeanCloud.Engine {
}
return mi.Invoke(null, ps);
} catch (TargetInvocationException e) {
throw e.InnerException;
Exception ex = e.InnerException;
if (ex is LCException lcEx) {
throw new Exception(JsonConvert.SerializeObject(new Dictionary<string, object> {
{ "code", lcEx.Code },
{ "message", lcEx.Message }
}));
}
throw ex;
}
}