Server Side custom exception

P

problemKing

Hi all,

I had created a Remoting Custom Exception that inherits from System.Exception.
Now, i meet the same problem that has been posted by previous thread
http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-csharp/56784/Server-Side-custom-exception


Below is the coding that i wrote,

// Remoting Custom Exception

[Serializable]
public class DbActionException : Exception
{
public DbActionException() : base()
{ }
public DbActionException(string message)
: base(message)
{ }
public DbActionException(string message, System.Exception inner)
: base(message, inner)
{ }
protected DbActionException(SerializationInfo info, StreamingContext
context)
: base(info, context)
{ }
public override void GetObjectData(SerializationInfo info,
StreamingContext context)
{
base.GetObjectData(info, context);
}
}


// in DAL Layer

try{ //Do somethings }
catch(Exception ex)
{
throw new DbActionException(ex.ToString());
}

// in Service Layer

try{ //Do somethings }
catch(DbActionException ex)
{
throw ex;
}

// in UI Layer

try{ //Do somethings }
catch(DbActionException ex)
{
ExceptionPolicy.HandleException(ex, "LoggingPolicy")
}


The problem is - in my UI layer (client side), it requests for server layer's
assembly. If i didn't add the service layer assembly, the error of Could not
load file or assembly <name>, Version=<version>... or one of its dependencies.
The system cannot find the file specified.":"<name>, Version=<version>...
If i added the service layer assembly, this error won't occur and the
exception is succeed to log. But as everyone knows that it is make sense that
service layer dll cannot be added at UI layer right?



Do anyone have the solution?
Thanks for any reply!


Regards,
 
P

problemKing via DotNetMonster.com

Hi all,

Any solution?

Thanks for any reply!

Regards,

Hi all,

I had created a Remoting Custom Exception that inherits from System.Exception.
Now, i meet the same problem that has been posted by previous thread
http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-csharp/56784/Server-Side-custom-exception

Below is the coding that i wrote,

// Remoting Custom Exception

[Serializable]
public class DbActionException : Exception
{
public DbActionException() : base()
{ }
public DbActionException(string message)
: base(message)
{ }
public DbActionException(string message, System.Exception inner)
: base(message, inner)
{ }
protected DbActionException(SerializationInfo info, StreamingContext
context)
: base(info, context)
{ }
public override void GetObjectData(SerializationInfo info,
StreamingContext context)
{
base.GetObjectData(info, context);
}
}

// in DAL Layer

try{ //Do somethings }
catch(Exception ex)
{
throw new DbActionException(ex.ToString());
}

// in Service Layer

try{ //Do somethings }
catch(DbActionException ex)
{
throw ex;
}

// in UI Layer

try{ //Do somethings }
catch(DbActionException ex)
{
ExceptionPolicy.HandleException(ex, "LoggingPolicy")
}

The problem is - in my UI layer (client side), it requests for server layer's
assembly. If i didn't add the service layer assembly, the error of Could not
load file or assembly <name>, Version=<version>... or one of its dependencies.
The system cannot find the file specified.":"<name>, Version=<version>...
If i added the service layer assembly, this error won't occur and the
exception is succeed to log. But as everyone knows that it is make sense that
service layer dll cannot be added at UI layer right?

Do anyone have the solution?
Thanks for any reply!

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top