How to check for LINQ to SQL connection error
How to check if Linq.DataContext object is filled with data and no connection error has appeared? Thanks. ...
How to check if Linq.DataContext object is filled with data and no connection error has appeared? Thanks. ...
This is probably an easy question to answer, but I don't see it mentioned in the documentation... What happens when insert results in an error? Is an exception thrown? What type? I'm trying to understand what would happen when trying to insert duplicate data in a column that is unique. So I feel like I need to do some checking first......
Although I'm sure it's possible I cannot see how I would be able to do the following. Using .htaccess to point the html errors to a single error handling page (this bit not a a problem). That page then checks what the error code actually was (404, 500 etc.) and displays a message according to each one. I am trying to do it in a PHP en...
Hello, I have come accross to this function below and I am wondering wether this is the right way of using the error handling of try/catch. public function execute() { $lbReturn = false; $lsQuery = $this->msLastQuery; try { $lrResource = mysql_query($lsQuery); if(!$lrResource) { throw new MysqlException("Unable to execute...
Hello, How do I call WSAGetLastError() from WinAPI so I get the valid text error? ...
Hello friends. On a site I run, I have 404's and 500 errors mapped to redirect to a custom error page for end users; using the following code in my web.config: ... ... <system.web> <customErrors defaultRedirect="/404/default.aspx" mode="RemoteOnly"> <error statusCode="404" redirect="/404/default.aspx" /> </customErrors> ...
I used to use this when I wanted to trigger errors in PHP, coming from a PHP4 background. Note I had my own set_error_handler() for handling these errors. if ($error) { trigger_error('Sorry, error has occured'); } I can't remember where, but sometime ago someone told me I should be 'using exceptions'. As I'm re factoring a lot of ...
We have been developing an ASP.NET application that works with the Google Maps API to assist in logistics and planning for a small shipping company in our area. One of the features is for the company to input a list of customers and the system will package up all the customer addresses as a series of waypoints, send it off to Google, and...
In a regular ASP.NET application, you might have a customErrors section like the following: <customErrors mode="On"> <error statusCode="404" redirect="Nice-FileNotFound-Page.aspx"/> </customErrors> Is it possible to set the 404 error programmatically at Application_Start? Something like the following: // Figure out which page shou...
Hi guys, I'm writing an application that uses a COM library. I have a class library that wraps the calls to the COM library and adds some more functionality. Eventually this will run as a Windows Service. For now I test it using a Winforms test harness. When the class library is created by the test harness everything seems to be working...
I have an application that reads data from a com port using javax.comm. The problem I am having is that if the device that I'm reading from is unexpectedly disconnected I get an error in the console that says "WaitCommEvent: Error 5" I have looked around and can't find any helpful information about this. I have set all of the notifyOn...
Duplicate: Automatic feedback on JavaScript error Logging JavaScript-Errors on Server How would I go about logging errors in javascript? I can't wrap every line of javascript in try catch block. I talking about the errors that for example in IE, would show an Error On page message and have the line and char the caused th...
If a call to fread() returns 0 and ferror() indicates an error (vs. EOF), is it OK to retry the read or is it better to close and reopen the file? I can't start over entirely -- the input file has been partially processed in a way that can't be undone (say I'm writing out a chunk at a time to a socket and, due to existing protocol, have...
This question is actually a result of an interesting discussion at programming.reddit.com a while ago. It basically boils down to the following code: int foo(int bar) { int return_value = 0; if (!do_something( bar )) { goto error_1; } if (!init_stuff( bar )) { goto error_2; ...
I am trying to set up my WPF application so that when an exception goes unhandled, an error dialog pops up. In good ol' WinForms this was possible by adding Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); To your Program.cs file and then showing whatever dialog you wanted i...
Using C#, is there a better way to handle multiple types of exceptions rather than a bunch of ugly catch blocks? What is considered best practice for this type of situation? For example: try { // Many types of exceptions can be thrown } catch (CustomException ce) { ... } catch (AnotherCustomException ace) { ... } catch (Ex...
I'm using SAS 9.2 on OpenVMS to connect to an external data source over a socket specifed with a filename statement: filename extsrc SOCKET "extserver:port" recfm=v; data foo; infile extsrc; input; .... some statements to read stuff ...; run; This works (as it should) 99% of the time. However, once in a while the program that is supp...
The TSQL BEGIN TRY and BEGIN CATCH block pattern does not catch errors due to a lost client connection. How can I catch and handle a lost client connection? I'm setting a flag that indicates processing while processing a loop of individual transactions and the catch block re-sets that flag on error, but if the client connection is lo...
I've google'd around a bit, and haven't really found a good answer for my question: What is the customary way to pass back error information to java from native jni code? I would normally just pick a design and go with it, but this code is called every 5 milliseconds, (approx), so I thought I'd ask if there's a customary 'clean / effic...
Let's say I have a web service which returns a collection of images based on a passed in user. Now I call the web service with a invalid user. The call throws a UnauthorizedAccessException with a message saying the user is not authorized to get the collection. I want this message to be localized. Where do I localize this message, on the...