От: | ie | http://ziez.blogspot.com/ | |
Дата: | 27.09.05 10:49 | ||
Оценка: | 125 (16) +6 |
IModule module;
try
{
...
module = ModuleFactory.CreateModule(moduleType, moduleContext, moduleParameters);
module.Run();
...
}
catch (Exception ex)
{
launcherContext.Log(LogType.Error, string.Format("Unhandled exception in module {0}...", moduleType), ex);
return false;
}
finally
{
module.Dispose();
}
try
{
{SomeCodeThatThrowsException}
}
catch (SocketException sex)
{
if (tries >= TRIES_COUNT)
{
moduleContext.Log(LogType.Debug, "Some error occurs during network operations. Error message: " + sex.Message);
throw sex;
}
else
{
tries++;
}
}
static void Main(string[] args)
{
try
{
FunctionThatThrowsException(); // line 13
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
private static void FunctionThatThrowsException()
{
try
{
GenerateException();
}
catch (Exception ex)
{
/* тут некоторая обработка */
throw ex; // line 29
}
}
private static void GenerateException()
{
throw new Exception("Some exception.");
}
System.Exception: Some exception.
at TestExApp3.Program.FunctionThatThrowsException() in W:\...\TestExApp3\Program.cs:line 29
at TestExApp3.Program.Main(String[] args) in W:\...\TestExApp3\Program.cs:line 13
private static void FunctionThatThrowsException()
{
try
{
GenerateException();
}
catch (Exception ex)
{
/* тут некоторая обработка */
throw; // line 29
}
}
private static void GenerateException()
{
throw new Exception("Some exception."); // line 35
}
System.Exception: Some exception.
at TestExApp3.Program.GenerateException() in W:\...\TestExApp3\Program.cs:line 35
at TestExApp3.Program.FunctionThatThrowsException() in W:\...\TestExApp3\Program.cs:line 29
at TestExApp3.Program.Main(String[] args) in W:\...\TestExApp3\Program.cs:line 13
private static void FunctionThatThrowsException()
{
try
{
GenerateException(0);
GenerateException(2);
}
catch (Exception ex)
{
/* тут некоторая обработка */
throw; // line 31
}
}
private static void GenerateException(int p)
{
if (p > 0)
{
throw new Exception("Some exception."); // line 38
}
}
System.Exception: Some exception.
at TestExApp3.Program.GenerateException(Int32 p) in W:\...\TestExApp3\Program.cs:line 38
at TestExApp3.Program.FunctionThatThrowsException() in W:\...\TestExApp3\Program.cs:line 31
at TestExApp3.Program.Main(String[] args) in W:\...\TestExApp3\Program.cs:line 13
private static void FunctionThatThrowsException()
{
try
{
GenerateException(0);
GenerateException(2); // line 26
}
catch (Exception ex)
{
/* тут некоторая обработка */
throw new Exception("Some exception in FunctionThatThrowsException(). See inner exception for more information.", ex); // line 31
}
}
private static void GenerateException(int p)
{
if (p > 0)
{
throw new Exception("Some exception."); // line 38
}
}
System.Exception: Some exception in FunctionThatThrowsException(). See inner exc
eption for more information. ---> System.Exception: Some exception.
at TestExApp3.Program.GenerateException(Int32 p) in W:\...\TestExApp3\Program.cs:line 38
at TestExApp3.Program.FunctionThatThrowsException() in W:\...\TestExApp3\Program.cs:line 26
--- End of inner exception stack trace ---
at TestExApp3.Program.FunctionThatThrowsException() in W:\...\TestExApp3\Program.cs:line 31
at TestExApp3.Program.Main(String[] args) in W:\...\TestExApp3\Program.cs:line 13
catch (Exception ex)
{
throw ex;
}
private void OpenActiveDataConnection(ref Socket servsock)
{
try
{
string szReply;
IPEndPoint ipeClient = (IPEndPoint)FTPSocket.LocalEndPoint;
servsock.Bind(new IPEndPoint(IPAddress.Parse(ipeClient.Address.ToString()),0));
IPEndPoint ipeServer = (IPEndPoint)servsock.LocalEndPoint;
int iTransferPort = ipeServer.Port;
int iPortPart1 = (iTransferPort&0xff00) >> 8;
int iPortPart2 = iTransferPort&0x00ff;
SendCommand("PORT "+ipeClient.Address.ToString().Replace('.',',')+","+iPortPart1.ToString()+","+iPortPart2.ToString());
szReply = GetReply();
if (!CheckReply(szReply,"200"))
throw(new FTPClientException(RemoveReturnCode(szReply)));
servsock.Listen(5);
return;
}
catch (System.Exception ex)
{
throw(ex);
}
}