StrataFrame Forum
Back
Login
Login
Home
»
.NET Forums
»
General .NET Discussion
»
StrataFrame Exceptions vs .NET Exceptions
StrataFrame Exceptions vs .NET Exceptions
Post Reply
Like
1
StrataFrame Exceptions vs .NET Exceptions
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
StrataFrame Team
S
StrataFrame Team
posted 11 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
You can throw any exception you want. According to Microsoft's guidelines, they used to say that you should base any exceptions you create off of ApplicationException. It's the base class for almost every exception in the .NET Framework. But they have now changed their mind:
About halfway down this article:
http://msdn.microsoft.com/en-us/library/vstudio/seyhszts(v=vs.100).aspx
For most applications, derive custom exceptions from the
Exception
class. It was originally thought that custom exceptions should derive from the
ApplicationException
class; however in practice this has not been found to add significant value.
You can throw StrataFrameExceptions if you want. We don't add any extra features to the StrataFrameException class. We created it and the BusinessLayerException and DataLayerException classes in order to wrap common exceptions and give more information that a developer can use to solve the problem. Most of it is configuration-related stuff. For instance, if you try to run a query without first adding a DataSource to the DataBasics.DataSources collection, we don't just throw a KeyNotFoundException from .NET, we wrap it and say "hey, you need to add a data source before you try this."
Now, the StrataFrameException class doesn't add anything extra, but we have some exception helpers that are useful. We have the MicroFour.StrataFrame.Tools.Exceptions class. The most useful method on it is the CreateExceptionDetails() method which returns a string that lists all of the inner exceptions and a combined stack trace of all of the inner exceptions. It also includes extra information on common exceptions like TypeLoadExceptions and such that have extra details in there internal IList stuff.
We also have the MicroFour.StrataFrame.Application.ApplicationErrorDialog which shows an exception using the CreateExceptionDetails() method mentioned above in a nice, red box.
The default project template also adds handlers to AppDomain.Current.UnhandledException to trap exceptions that are, you guessed it, unhandled.
Hope that helps.
Reply
Like
1
William Fields
William Fields
posted 11 Years Ago
ANSWER
Topic Details
Share Topic
Group: StrataFrame Users
Posts: 80,
Visits: 239
Hello,
I'm a begginer StrataFrame developer and am interested in what benefit I would get out of using the StrataFrame Exception class over just the base .NET exception class.
I have a console app that has a very basic try/catch error handler where an exception is entered into the Windows EventLog like this:
l_ovCalLog.WriteEntry(l_oException.ToString(), EventLogEntryType.Error)
Which is fine for what I'm using it for, but I'm interested in what StrataFrame tools/classes I can use for my benefit outside of a normal Winforms app.
Tags
error handling
exception
Reply
Like
1
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
1
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search