mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Unify exception display in command-line
--HG-- branch : dev
This commit is contained in:
@@ -99,13 +99,7 @@ namespace Orchard.Commands {
|
|||||||
return CommandReturnCodes.Retry;
|
return CommandReturnCodes.Retry;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
for (int i = 0; e != null; e = e.InnerException, i++) {
|
OutputException(output, e);
|
||||||
if (i > 0) {
|
|
||||||
output.WriteLine("-------------------------------------------------------------------");
|
|
||||||
}
|
|
||||||
output.WriteLine("Error: {0}", e.Message);
|
|
||||||
output.WriteLine("{0}", e.StackTrace);
|
|
||||||
}
|
|
||||||
return CommandReturnCodes.Fail;
|
return CommandReturnCodes.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,10 +115,7 @@ namespace Orchard.Commands {
|
|||||||
return CommandReturnCodes.Retry;
|
return CommandReturnCodes.Retry;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
for (; e != null; e = e.InnerException) {
|
OutputException(output, e);
|
||||||
output.WriteLine("Error: {0}", e.Message);
|
|
||||||
output.WriteLine("{0}", e.StackTrace);
|
|
||||||
}
|
|
||||||
return CommandReturnCodes.Fail;
|
return CommandReturnCodes.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,14 +129,22 @@ namespace Orchard.Commands {
|
|||||||
return CommandReturnCodes.Ok;
|
return CommandReturnCodes.Ok;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
for (; e != null; e = e.InnerException) {
|
OutputException(output, e);
|
||||||
output.WriteLine("Error: {0}", e.Message);
|
|
||||||
output.WriteLine("{0}", e.StackTrace);
|
|
||||||
}
|
|
||||||
return CommandReturnCodes.Fail;
|
return CommandReturnCodes.Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OutputException(TextWriter output, Exception e) {
|
||||||
|
for (int i = 0; e != null; e = e.InnerException, i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
output.WriteLine("---- Inner Exception -----------------------------------------------------------------------");
|
||||||
|
}
|
||||||
|
output.WriteLine("Error: {0}", e.Message);
|
||||||
|
output.WriteLine(" Exception Type: {0}", e.GetType().FullName);
|
||||||
|
output.WriteLine("{0}", e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
|
||||||
private IContainer CreateHostContainer() {
|
private IContainer CreateHostContainer() {
|
||||||
var hostContainer = OrchardStarter.CreateHostContainer(ContainerRegistrations);
|
var hostContainer = OrchardStarter.CreateHostContainer(ContainerRegistrations);
|
||||||
|
Reference in New Issue
Block a user