Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am using .net 1.1 and i am trying to catch CONCURRENCY_EXCEPTION and throw a message for that exception using the code

 

if(ex.Message == "CONCURRENCY_EXCEPTION")

{

MessageBox.Show("This record has been updated since you opened it. Please close the record and re-open it.");

}

 

it works when i try to compile it in my machine but after deploying the code it does not catch this error.It just give a general "Server encountered an internal error".

 

Can any one help me in this.

Posted

private void HandleUnhandledExceptions(Exception ex)

{

MessageBox.Show(ex.ToString());

if(ex.Message == "CONCURRENCY_EXCEPTION")

{

MessageBox.Show("This record has been updated since you opened it. Please close the record and re-open it.");

}

else

{

GlobalUI.DisplayFatalErrorMessage();

}

 

if((ex.Message != "SERVER_EXCEPTION") && (ex.Message != "CONCURRENCY_EXCEPTION"))

{

ServiceObj.LogClientException(ex);

}

// //TODO if an exception occurs inside frmMain, this would close active form which would not be expected behavior.

// //need to resolve.

// if (this.ActiveMdiChild != null)

// {

// this.ActiveMdiChild.Dispose();

// }

}

Posted

am using remoting here and when i tryed to google for this problem in internet some ppl have sugested to use

 

<customErrors mode="on" /> and i have used this in the webconfig file of the server but it still dosen't work

 

I am using remoting here
Posted
There's still not enough to work with. But, if I were you, I would not drive your logic off of string comparisons with the .Message property. Do something like this instead:
if (ex is NullReferenceException)
{
   // do something
}
else if (ex is MissingMemberException)
{
   // do something
}
else
{
   // ex is some other type of exception
}

Posted
It gives a error called "message: 'Server encoutered an internal error. for more information, turn on the customErrors in server's .config file'" when i deploy it in the server with the ex as "sever_exception" but when i compile it in the local machine it works properly and the ex vaule is "concurrency_exception" and it goes into the if block and displays the message i have typed

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...