S
Schizoid
Can someone give me some ideas where I am going wrong? I want to
create a class library that will be used by other programs. In this
library, there is a method to get a list of subdirectories. I want
any exception to return back to the calling program. When I call
this
method, it abends at the point of the exception and does not return
the exception to the calling program:
Calling program:
....
MyObject f = new MyObject();
string[] sf = f.GetSubFolders(@"C:\sadfsfa"); //
directory does not exist
Library:
public class MyObject
{
public string[] GetSubFolders(string location)
{
if (!Directory.Exist(location)
throw new DirectoryNotFoundException(); //
abend
}
}
Why does the program abend at the "throw" line? Shouldn't the throw
return the exception to the calling program?
I also tried changing the GetSubFolders method to use try-catch
statements and it also abends at the trow statement.
thanks
create a class library that will be used by other programs. In this
library, there is a method to get a list of subdirectories. I want
any exception to return back to the calling program. When I call
this
method, it abends at the point of the exception and does not return
the exception to the calling program:
Calling program:
....
MyObject f = new MyObject();
string[] sf = f.GetSubFolders(@"C:\sadfsfa"); //
directory does not exist
Library:
public class MyObject
{
public string[] GetSubFolders(string location)
{
if (!Directory.Exist(location)
throw new DirectoryNotFoundException(); //
abend
}
}
Why does the program abend at the "throw" line? Shouldn't the throw
return the exception to the calling program?
I also tried changing the GetSubFolders method to use try-catch
statements and it also abends at the trow statement.
thanks