error-handling

Error handling in Visual Basic Editor for email field in excel form

Hi folks, I am currently coding a form in excel. I was wondering if there was a way to search the contents of a field for certain characters. I was thinking about using this method to construct a code to check for the integrity of the data entered within the email field. It would look for an "@" and a "." and probably output a boolean v...

Ruby on Rails -HTTP error handling

Hello all, This is my first post here, so I hope that I am posting this question the right place. Otherwise, please let me know so that I know for next time I post here :) I am working on a RoR website and would like to handle server errors (400, 404, 500, etc.) individually. Also, since the website is dynamic I would like to handle th...

Haskell: Composing two error-raising functions

The problem I have been given says this: In a similar way to mapMaybe, define the function: composeMaybe :: (a->Maybe b) -> (b -> Maybe c) -> (a-> Maybe c) which composes two error-raising functions. The type Maybe a and the function mapMaybe are coded like this: data Maybe a = Nothing | Just a mapMaybe g Nothing...

error handling with NSURLConnection sendSynchronousRequest

how can i do better error handling with NSURLConnection sendSynchronousRequest? is there any way i can implement - (void)connection:(NSURLConnection *)aConn didFailWithError:(NSError *)error i have a nsoperation queue which is getting data in background thats why i have sync request. and if i have to implement async request then how c...

Which error code to return when a passed object doesn't implement a necessary interface?

In COM when I have a well-known interface that I can't change: interface IWellKnownInterface { HRESULT DoStuff( IUnknown* ); }; and my implementation of IWellKnownInterface::DoStuff() can only work when the passed object implements some specific interface how do I handle this situation? HRESULT CWellKnownInterfaceImpl::DoStuff( ...

What possible errors could I expect to recieve in System.Net.Mail.SendCompletedEventHandler?

I am using the SendAsync method to send some emails out. What different errors could possibly be returned in the AsyncCompletedEventArgs in the SendCompletedEventHandler? Is there recommended practices for handling these? ...

warning problem: expects parameter 1 to be mysqli_result

I get the following warning listed below and I was wondering how do I fix it Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given on line 65 The code is around this section of PHP code listed below. I can list the full code if needed. // function to retrieve average and votes function getRatingText(){ ...

ValidateRequest per control

Hi, My ASP.NET page contains "ValidateRequest = true". However, there is one textbox in the page for which I don't want ASP.NET to validate. Is there a way to make it false for that one control? If there isn't, is there a way to ignore the "Potential Threat" error, assuming it comes from that particular control? Thanks ...

Containing thrown exceptions in MDI child forms

I have a .NET MDI form based application. I would like to contain errors thrown in a child form within that form so I can invalidate it without closing the entire application. Is there a solution that does not involve catching all errors in Application.ThreadException? ...

Recording SQL Server call stack when reporting errors

This is a follow up to the question Nested stored procedures containing TRY CATCH ROLLBACK pattern? In the catch block I use a stored procedure to report (reraise) the error by reading from ERROR_MESSAGE(), ERROR_PROCEDURE(), ERROR_LINE(), etc. As described here I also have a check so that it can determine if the error has already been ...

VB6 - How to catch exception or error during runtime

I developed an application in VB6. In client's environment it raises runtime errors which I can't reproduce under debugger. Is there any way to get the stacktrace or location of error? I created log file and I used Err.Description,Err.Source but it gives blank values. Please help me. my method(...... On Error GoTo Error...

What Exception Type to throw for strings

If I've got the following, really for any string where you check IsNullOrEmpty and it turns up empty, what kind of exception type should one throw, and it's not a argument to a method? I always have a hard time picking exception types because there are so damn many of them. And this is just grabbing a value from the web.config and chec...

How to handle PDO exceptions

Hi, I'm trying to work with PDO class on php but I have some trouble to find the right way to handle errors, I've wrote this code: <?php // $connection alreay created on a class which works with similar UPDATE statements // I've simply added here trim() and PDO::PARAM... data type $id = 33; $name = "Mario Bros."; $url = "http://ninten...

jQuery $.ajax() function's error message source

In the case of failure, the code goes something like: error: function(msg) where does the msg come from? EDIT: I am using this function ($ajax) to call a WEB SERVICE. So if whoever voted this down could explain to me where msg comes from that would be great! Do I set it in web service? If so, how? Please don't copy and paste the def...

MsBuild - Is it possible to isolate batch tasks, so one failing task doesn't skip the remaining tasks?

Let me start by example... I have an all.proj that looks similar to this: <ItemGroup> <ProjectsToBuild Include="..\Sites\*\*.csproj" /> </ItemGroup> <Target Name="DeployWebsites" DependsOnTargets="BuildMergedSolutions"> <AspNetCompiler PhysicalPath="%(ProjectsToBuild.RootDir)%(ProjectsToBuild.Directory)" TargetPath="%(Proj...

Try Catch blocks inside or outside of functions and error handing

This is more a general purpose programming question than language specific. I've seen several appraoches to try and catches. One is you do whatever preprocessing on data you need, call a function with the appropriate arguments and wrap it into a try/catch block. The other is to simply call a function pass the data and rely on try catch...

Error handling. How should a program do it?

Hi there. How should a program handle errors? Example: A program needs the file text.txt. It must exist and be writable. What should it do if it's not writable or doesn't exist? Should it try to chown/chmod the file? Should it try to create it or just display an error message? Or: Should it try to find a solution or just display an er...

How do i create a 404 image? for images that cannot be read by ASP.NET

Using ASP.NET C#, visual studios to host the files/pages. I allow users to upload images and i redirect them to the media page. The images are in a specific path easily recognizable with regex. When i redirect i get 1 of 2 errors. 1) Image doesnt exist (hasnt been generated) or 2) Cannot open file (imagemagik or something writing to the ...

Invalid Form Submissions-- what to do with them?

I've been doing a lot of reading lately about best practices when it comes to Web App design. My language of expertise is PHP/MySQL. When creating an MVC architecture for an application I'm developing, I always come across the problem of where to store invalid form submissions (so that the user doesn't have to re-enter the data, and help...

Writing Pythons Errors to a txt file

I am having trouble getting this to work correctly (obviously) - I am ALMOST there, and I have a good idea of WHY it is not working - just not sure how to make it work. This is suppose to attempt to read a file into memory, if it fails it goes to the "except" clause of the block of code (that part is 'duh'). The error file prints: "<...