error-handling

Unable to catch std::invalid_argument

I've run into an issue catching a std::invalid_argument exception that I'm not able to trace. I'm using gcc 4.4.0 (windows), pthreads-win32 2.8.0 the GC2 dll. Basically, from two threads (main thread and a thread started using pthread_create), I try to create an instance of class A at roughly the same time. The constructor throws an st...

global javascript error handling

Is there any way to catch Javascript errors globally across the web application by writing some code in the master page? ...

Whats' a good way to extend Error in JavaScript?

I want to throw some things in my JS code and I want them to be instanceof Error, but I also want to have them be something else. In Python, typically, one would subclass Exception. What's the appropriate thing to do in JS? ...

Logging SQL Errors

SQL Server 2008 has a new try/catch structure. If I encounter an error in a sequence of nested stored procedures, I like to log the call stack in an error table. The problem is that if I have started a transaction (which will be true for operations that update the db), an records written to the error table will be removed when the code...

REG_EPAREN in php

Im using eregi() function for matching the string but it is giving the following error :- PHP Warning: eregi() [<a href='function.eregi'>function.eregi</a>]: REG_EPAREN in /a/b/c/mysite/file.php on line 59, referer: xyz.com im using this function here :- if(eregi($check,$in)) { $titles=ucfirst(substr($desc, 0, 38)); } else { ...

Stop Inserting in Table if record already exists

Hi, I have sql server procedure, please see below. ALTER PROCEDURE [dbo].[uspInsertDelegate] ( @CourseID int, @CPUserID int, @StatusID int, @CreateUser varchar(25) ) AS SET NOCOUNT OFF; INSERT INTO tblDelegate ( CourseID, CPUserID, StatusID, CreateUser ) VALUES ( ...

Exception vs. error-code vs. assert

I'm working on a library that generates reports of devices. The generate_report (const std::string& no) member function can fail due to various reasons: invalid report no. invalid state (the report_generator is a FSM) no device is active error during report generation Which error-handling mechanism is best for these errors? just re...

Serial Port - Open errors

Hi, When opening a serial port, the device I am trying to access may not have a baudrate of 9600 set so I will have to go thru each baudrate until the device opens correctly. What error, ArgumentOutOfRangeException or an IOException or some other, should I look for after performing the Port.Open ? Or do I perform this check using the P...

SQL Server batch problem with error handling

I have a problem regarding SQL batches in SQL Server. Assume I execute a SqlCommand using the following code: private void Example(SqlConnection connection, SqlTransaction transaction) { using (SqlCommand cmd = new SqlCommand("select * from T1; EXECUTE('update T2 set 1=2')", connection, transaction)) { SqlDataReader ...

Force antlr3 to immediately exit when a rule fails

I've got a rule like this: declaration returns [RuntimeObject obj]: DECLARE label value { $obj = new RuntimeObject($label.text, $value.text); }; Unfortunately, it throws an exception in the RuntimeObject constructor because $label.text is null. Examining the debug output and some other things reveals that the match against "label...

Error handling using events, checking if an error happened and react accordingly

I have an object, say Order where if an error occurs, it raises the ErrorOccurred event. If I'm running some code in say, the codebehind for a .aspx page with an public Order registered as WithEvents and I want to check to see if an error has occurred before I run more code, how do I do this? I can't simply check theOrder.ErrorOccurred. ...

Database transaction only partially committing

I've got a T-SQL stored procedure running on a Sybase ASE database server that is sometimes failing to commit all of its operations, even though it completes without exception. Here's a rough example of what it does. BEGIN TRANSACTION UPDATE TABLE1 SET FIELD1 = @NEW_VALUE1 WHERE KEY1 = @KEY_VALUE1 IF @@error <> 0 OR @@rowcount <> 1 BE...

catching exceptions thrown from a c# web service in javascript

If an exception is thrown in my web service and I wanted to give the user a more meaningful error message rather than a generic 'an error has occurred when processing your request', what are some possible techniques that can be used to pass the exception message back to the client? is this something that is acceptably practiced? ...

GDI+ General Error on ScreenShot

I have the below Exception Extension for my in house Winform App. My problem is that I get a generic GDI+ error on ss.save("C:\\HelpMe.jpg", ImageFormat.Jpeg); It is not every time as it will work and then error out. Sometimes it will work a couple of times in a row. Is this a "locking" issue, possibly? What else should I look at ...

How do I capture a SQLPlus exit code within a shell script?

I have a korn shell script that is login into sqlplus and executing a script. Within the shell script I would like to capture the status code of the sql statement that was executed. Currently there is an error with sql I'm unable to capture it by checking $?. How would I capture the success or error code from the sql statement and pass...

Ruby Web API scraping / error handling with Hpricot

I have written a simple ruby gem to scrape a set of websites, providing a simple API, inside the gem itself I have included a retry method... to attempt to use Hpricot 3 or more times on failure mostly due to timeouts. def retryable(options = {}, &block) opts = { :tries => 1, :on => Exception }.merge(options) retry_exception, retri...

How can I create a Windows App(C#) that has where I can display all the exceptions in various objects in a message box

I am trying to use MVC in C#. So the form controller uses the authentication class instance. I am handling the invalid credentials in the authentication class. But I cannot display that message in the message box as it is not in the form controller class instance. Please help ...

Can Firebug be required to run my website?

I'm working on a new project which has some complex javascript. I can't post any code so that's not what my question is about. I have a script which works in Firefox 3.0. It was pointed out that the script did not work in Firefox 3.5, so I'm trying to make it work. Indeed the script didn't produce the expected results, so I installed th...

Recommended approach on handling SqlExceptions in db applications

Hi, I work on a database application written in C# with sql server as backend. And for data integrity, I try to enforce as much as possible on database level - relations, check constraints, triggers. Due to them, if data is not consistent, the save / update / insert can fail, and app throw SqlException. I do various validations both i...

how to avoid runtime error pages in asp.net application

I have an asp.net application.When I opened the application,I got a runtime exception with the description saying, "An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code". When ever I get this kind of runtime...