error-handling

How do you convert an IPhone OSStatus code to something useful!?

I am getting more than a little sick of this iphone sdk and it's documentation... I am calling AudioConverterNew in the documentation under Returns: it says "returns a status code" ... really... so far, through playing around with the parameters I have only been able to get two different errors neither of which are listed at the botto...

How can I retrieve current terminate() handler without changing it?

Here's the problem. My application calls CoCreateInstance() to create a COM object implemented in a third-party DLL. That DLL calls set_terminate() to change the terminate() handler and passes an address of its own terminate() handler there. The initial terminate() handler address is not saved by that library - it doesn't care and simpl...

What does the "On Error Resume Next" statement do?

I came to some VBScript examples, and I saw the statement On Error Resume Next basically at the beginning of the script. What does it do? ...

Whats a good way to show errors/messages to users in php?

I have been using my own method for years, but I figured maybe its not the best way to go about it. Essentially when I want to throw an error to a user, or display confirmation of a successful action, I do the following: if($something == "condition") { $_SESSION["message"] = "Your passwords didnt match! Make sure they are the same ...

How to properly use the write() function for sockets ?

I'm using the write() function to write to a socket in C. I am not a C expert, and sometimes I know this function can fail, in those cases it can return some kind of SIGPIPE. Here's the simple piece of code I'm using now: if(write(sockfd, sendline, sizeof(sendline)) < sizeof(sendline)) { printf("Failed to write string %s t...

What should I return for errors in my functions in C?

Hi, Currently I'm returning -1 in my custom functions in C if something wrong happens and 0 for success. For instance, working with a linked list and some function needs a non-empty list to work properly. If the list passed as argument is empty, I return -1 (error) and 0 if it's not empty and the function worked without a problem. Shou...

imagecreatetruecolor fails with 1536X1962 but not smaller diminsions

I have narrowed down my problem to show the size of the file matters. I don't know when the file is to big however. How can I catch the error. A 1.1mg file causes imagecreatetruecolor to bail but it chuggs along just fine when processing a 688k file. Thanks ...

How would I hook into/replace the "end user" YSOD?

I want to display the YSOD when it would be providing useful information during development or locally on the servers but a semi-generic page in other cases. I know that I could set the defaultRedirect attribute of the application's <customErrors> configuration tag in web.config, but I would rather do some processing to generate a page w...

Output the rendered contents of a page on a JavaScript error

I'm having problems with getting decent JavaScript error invormation in a Production environment. When I'm developing I can just attach a debugger and (usually) fix the problem. When I get the same error in a production environment however at best I see is an error report that looks like this: Error: Object doesn't support this pro...

How can I detect errors programatically when building an egg with setuptools?

If I have a script that builds eggs, basically by running python setup.py bdist_egg --exclude-source-files for a number of setup.py files that use setuptools to define how eggs are built, is there an easy way to determine if there were any errors in building the egg? A situation I had recently, was that there was a syntax error in a ...

Pluggable Error Handling Strategy

Hi, I have service object (Service A), that has some specific repetitive asynchronous task . This service object also has a supervising object (Service B). I want to handle most of the errors concerning the specific task in Service A and only inform Service B if it needs to take any additional measures (e.g. when Service A does not kno...

multiple error-code configuration web.xml

I'd like to direct all errors to my Errorsevlet without specifying all the codes explicitly. Is there any way to do like that? <error-page> <error-code>400</error-code> <location>/servlet/com.abc.servlet.ErrorServlet</location> </error-page> *And after reaching the ErrorServlet how can i get the stack trace of the error in the...

Error handling patterns for multithreaded apps using WF?

I was writing up a long, detailed question, but just scrapped it in favor of a simpler question that I didn't find an answer to here. Brief app description: I have a WPF app that spawns several threads, and each thread executes its own WF. What are some of the best ways to handle errors in the threads and WF that will allow user inte...

How do you handle all errors generated by a MySQL stored procedure

Background I'm writing a web application and I have a stored procedure which inserts some data into a table. As a programmer I am suspect of IO so my gut tells me I need to do some exception handling in case this write fails. The intended effect of the error handling within the stored procedure would be to set a flag to be consumed by...

CFNetwork still passing CFStreamErrors even though its deprecated?

I'm writing some code that is wrapping up some CFNetwork stuff to do DNS resolution in Objective-C. Everything is fine and it's working, but I have a few questions: The callback function prototype for CFHost's asynchronous resolution is passing references to CFStreamError structures even though the documentation says CFStreamError is d...

iPhone Core Data "Production" Error Handling

Hi there, I've seen in the example code supplied by Apple references to how you should handle Core Data errors. I.e: NSError *error = nil; if (![context save:&error]) { /* Replace this implementation with code to handle the error appropriately. abort() causes the application to generate a crash log and terminate. You should not use ...

Improving ANTLR DSL parse-error messages

I'm working on a domain-specific language (DSL) for non-programmers. Non-programmers make a lot of grammar mistakes: they misspell keywords, they don't close parentheses, they don't terminate blocks, etc. I'm using ANTLR to generate my parser; it provides a nifty mechanism for handling RecognitionExceptions to improve error handling. ...

Get details about function call

In PHP, I'd like to get the details about a function call inside the function itself. The behavior I want (without doing this) is to have debug_backtrace() passed as an argument to the function. I want that done automatically, for every call to a function. I need this so I can have pre-defined errors for a fairly sizable project I'm wo...

.net : How to correctly catch an internet connection error during web service call?

I am calling a 3rd party web service, during testing I am simulating what would happen if the web server lost internet connectivity by disabling the network adapter during a web service operation. I have a simple try/ catch scenario. The ex.message is : There is an error in XML document (1, 1709). The ex.InnerException.Message : Una...

Error handling in Lua using longjmp

I'm embedding a Lua interpreter in my current project (written in C) and I am looking for an example of how to handle errors. This is what I have so far... if(0 != setjmp(jmpbuffer)) /* Where does this buffer come from ? */ { printf("Aargh an error!\n"); return; } lua_getfield(L, LUA_GLOBALSINDEX, "myfunction"); lua_call(L, 0, 0);...