473,732 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Handling in Business Object Layer

Does anyone have suggestions on how to best handle errors in business
objects that are part of a business layer? For example:

Public Class Person
Private _name as string
Public Property Name as string
Get
Return _name
End Get
Set(Value as string)
If Value.toString. length > 50 then
'How do I send a friendly error message back to the
presentation layer saying the value isn't correct? I know I can
validate it on the form, but I'd like to also validate in the business
objects.
Else
_name = Value
End If
End Set
End Property

End Class
Thanks in advance for any help!!!
Big Dave

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #1
4 2064
In my business objects, I have a error collection class. It has a method to
pretty print the collection in html format.

I can then perform my business operation and catch all of the exceptions
without rethrowing them. Then, if my error collection has a size > 1 I know
there was an error and I print them to the page.

Or, just always put a try catch around business transactions and never put
them in your business/data layer.

There are always arguments either way..... to ignore errors in the
business/data layer and just continue processing or.... warn/throw an error
to the calling procedure when you encounter something bad!
--
Direct Email: Michael.Baltic@ RemoveCharacter sUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
"Big Dave" wrote:
Does anyone have suggestions on how to best handle errors in business
objects that are part of a business layer? For example:

Public Class Person
Private _name as string
Public Property Name as string
Get
Return _name
End Get
Set(Value as string)
If Value.toString. length > 50 then
'How do I send a friendly error message back to the
presentation layer saying the value isn't correct? I know I can
validate it on the form, but I'd like to also validate in the business
objects.
Else
_name = Value
End If
End Set
End Property

End Class
Thanks in advance for any help!!!
Big Dave

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #2
What do you do if Uncle Ernie drops his chopsticks?

--

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"Michael Baltic" <Mi***********@ discussions.mic rosoft.com> wrote in message
news:D0******** *************** ***********@mic rosoft.com...
In my business objects, I have a error collection class. It has a method
to
pretty print the collection in html format.

I can then perform my business operation and catch all of the exceptions
without rethrowing them. Then, if my error collection has a size > 1 I
know
there was an error and I print them to the page.

Or, just always put a try catch around business transactions and never put
them in your business/data layer.

There are always arguments either way..... to ignore errors in the
business/data layer and just continue processing or.... warn/throw an
error
to the calling procedure when you encounter something bad!
--
Direct Email: Michael.Baltic@ RemoveCharacter sUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
"Big Dave" wrote:
Does anyone have suggestions on how to best handle errors in business
objects that are part of a business layer? For example:

Public Class Person
Private _name as string
Public Property Name as string
Get
Return _name
End Get
Set(Value as string)
If Value.toString. length > 50 then
'How do I send a friendly error message back to the
presentation layer saying the value isn't correct? I know I can
validate it on the form, but I'd like to also validate in the business
objects.
Else
_name = Value
End If
End Set
End Property

End Class
Thanks in advance for any help!!!
Big Dave

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #3
LOL! I don't even know what movie/show that referenced, but I must have
laughed for like ten minutes!!!!
--
Direct Email: Michael.Baltic@ RemoveCharacter sUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
"Kevin Spencer" wrote:
What do you do if Uncle Ernie drops his chopsticks?

--

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"Michael Baltic" <Mi***********@ discussions.mic rosoft.com> wrote in message
news:D0******** *************** ***********@mic rosoft.com...
In my business objects, I have a error collection class. It has a method
to
pretty print the collection in html format.

I can then perform my business operation and catch all of the exceptions
without rethrowing them. Then, if my error collection has a size > 1 I
know
there was an error and I print them to the page.

Or, just always put a try catch around business transactions and never put
them in your business/data layer.

There are always arguments either way..... to ignore errors in the
business/data layer and just continue processing or.... warn/throw an
error
to the calling procedure when you encounter something bad!
--
Direct Email: Michael.Baltic@ RemoveCharacter sUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
"Big Dave" wrote:
Does anyone have suggestions on how to best handle errors in business
objects that are part of a business layer? For example:

Public Class Person
Private _name as string
Public Property Name as string
Get
Return _name
End Get
Set(Value as string)
If Value.toString. length > 50 then
'How do I send a friendly error message back to the
presentation layer saying the value isn't correct? I know I can
validate it on the form, but I'd like to also validate in the business
objects.
Else
_name = Value
End If
End Set
End Property

End Class
Thanks in advance for any help!!!
Big Dave

*** Sent via Developersdex http://www.developersdex.com ***


Nov 19 '05 #4
Thanks Michael,

Actuallly, it's a fragment that Uncle Chutney culled from a local radio
commercial. Taken out of context, it can mean almost anything, and strikes
me as quite ambiguously funny as well.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"Michael Baltic" <Mi***********@ discussions.mic rosoft.com> wrote in message
news:7F******** *************** ***********@mic rosoft.com...
LOL! I don't even know what movie/show that referenced, but I must have
laughed for like ten minutes!!!!
--
Direct Email: Michael.Baltic@ RemoveCharacter sUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
"Kevin Spencer" wrote:
What do you do if Uncle Ernie drops his chopsticks?

--

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"Michael Baltic" <Mi***********@ discussions.mic rosoft.com> wrote in
message
news:D0******** *************** ***********@mic rosoft.com...
> In my business objects, I have a error collection class. It has a
> method
> to
> pretty print the collection in html format.
>
> I can then perform my business operation and catch all of the
> exceptions
> without rethrowing them. Then, if my error collection has a size > 1 I
> know
> there was an error and I print them to the page.
>
> Or, just always put a try catch around business transactions and never
> put
> them in your business/data layer.
>
> There are always arguments either way..... to ignore errors in the
> business/data layer and just continue processing or.... warn/throw an
> error
> to the calling procedure when you encounter something bad!
> --
> Direct Email: Michael.Baltic@ RemoveCharacter sUpTo#NCMC.Com
>
> Staff Consultant II
> Enterprise Web Services
> Cardinal Solutions Group
>
>
> "Big Dave" wrote:
>
>> Does anyone have suggestions on how to best handle errors in business
>> objects that are part of a business layer? For example:
>>
>> Public Class Person
>> Private _name as string
>> Public Property Name as string
>> Get
>> Return _name
>> End Get
>> Set(Value as string)
>> If Value.toString. length > 50 then
>>
>>
>> 'How do I send a friendly error message back to the
>> presentation layer saying the value isn't correct? I know I can
>> validate it on the form, but I'd like to also validate in the business
>> objects.
>>
>>
>> Else
>> _name = Value
>> End If
>> End Set
>> End Property
>>
>> End Class
>>
>>
>> Thanks in advance for any help!!!
>> Big Dave
>>
>> *** Sent via Developersdex http://www.developersdex.com ***
>>


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4781
by: Steve - DND | last post by:
I was wondering if anyone can point me to some articles or practices they use for dealing with errors in their applications; particularly in an n-tier design. I am trying to find one way to conveniently handle both soft and hard errors, primarily for display to the end user. One method I have considered is rethrowing exceptions. With this approach, I would throw a plain old ApplicationException, with the Message property as the polite...
4
2525
by: aaj | last post by:
Hi all I have an automated application, that runs in the middle of the night. If certain 'non system' errors occur (things like malformed files, missing files etc..), I send an automatic Email and write a record to the database. This is handled in a class. When these errors occur, once Emailed and written I want to just end the App, simple as that.
1
2315
by: Oscar Thornell | last post by:
Hi, I have an ASP.NET page that generates an Exception... The Exception is not caught in the executing method...so it propagates to..the Page_Error event handling method.. In that method the Exception is handled by the client exception policy...basically it logs the information coming from the business layer... We then create a custom message object that contains user/context specific information and adds that to the Session object.....
1
483
by: michaeltorus | last post by:
Hi I'm currently designing a new web application in .Net. I've pretty covered everything, apart from error handling. There seems to be a few different way to do this, but something I've read often is that loading all your code with lots of try / catch blocks is not the best way. My application is made up of a number of different sub applications. A CRM Package, with financial services, compliance and commisions etc etc. Each part has...
4
7617
by: James Radke | last post by:
Hello, I am looking for guidance on best practices to incorporate effective and complete error handling in an application written in VB.NET. If I have the following function in a class module (note that this class module represents the business layer of code NOT the gui layer): Public Function Test(ByVal Parm1 As Integer, ByVal Parm2 As Integer) As SqlDataReader ' Declare the SQL data layer class Dim oSQL As New...
1
1883
by: Nemisis | last post by:
hi guys, Currently converting an old classic asp system to a OOP asp.net application. We are building the new application using a 3 tier arcitecture and i was wondering about the following. I have a parent class, that when inserted, inserts a few child classes into the database, based on other classes. In the old system, this is wrote as one big SQL script, with many inserts and updates because the system was not wrote as OOP.
0
1037
by: acnx | last post by:
I have an ntier application. I am trying to determine what is the best practice for handing errors in a datagrid. My datagrids are able to add, update and delete data. I am using a objectdatasource to access a proxy which calls a remote business object. The objectdatasource uses a custom class to pass the data to the business layer. The business layer method returns true or false. When false is returned I want to be able to handle this....
8
4132
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well. However i have recently started a project which will require synchronization to a remote database. Also the underlying database provider may change at a later date. From what i have read it seems that a layered approach is necessary, or at...
8
1755
by: Charles Law | last post by:
This is a sort of pattern question, but relating to how components are coupled in a three-tier system. I have a presentation layer, business layer and data access layer, the first is the EXE, whilst the other two are implemented as DLLs. The EXE also references a DLL that contains various user controls, one of which is based on a grid control. The coupling is currently like this:
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9445
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9234
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.