error-handling

Question on logging errors in WCF

I implemented a class that implements IErrorHandler interface to log WCF errors. One of the things that I'd like to do is log who the identity of the user than connected to my service when an exception occurred. All my logging occurs in HandleError() method of IErrorHandler interface, but since HandleError() may not have current operatio...

How to exit a matlab m-file (NOT the matlab itself) if the user enters bad inputs?

How to exit a matlab m-file (NOT the matlab itself) if the user enters bad inputs? I know if a m-file goes wrong at run time we can press Ctrl-C to stop it. but I need a command to put it in my m-file to do so if something bad happens. Please don't suggest 'exit' or 'quit' commands as they terminate the whole matlab and I don't want it...

java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind

What does this error mean? java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind My assignment is to create a client-side app that will exchange info w/ the server class that was supplied. We're supposed to use localhost. Here is the Server class... import java.io.File; import java.io.FilenameFilter; import java.i...

Should app crash or continue on normally while noting the problem?

Options: 1) When there is bad input, the app crashes and prints a message to the console saying what happened 2) When there is bad input, the app throws away the input and continues on as if nothing happened (though nothing the problem in a separate log file). While 2 may seem like the obvious solution, the app is an engine and framew...

Panic recover in Go v.s. try catch in other languages

I've just read this post about Panic/Recover in Go and I'm not clear on how this differs from try/catch in other mainstream languages. ...

Try/Catch for Javascript in mobile safari?

Can I wrap a try/catch around the opening of a URL in mobile safari? I know the question has been asked a number of different ways but essentially what I'm after is the trapping of bad URLs or the detection of when a specific URL cannot be opened by the browser. ...

Can't find the custom error page

Here's how I have it defined (locally, on my development machine): <customErrors mode="On" defaultRedirect="Error.aspx"> <error statusCode="404" redirect="NotFound.aspx" /> </customErrors> And I have the [HandleError] attribute: [Authorize] [HandleError] public class HomeController : Controller { // etc. Yet when I ...

Stopping the program if error is printed while running

import java.lang.Process; import java.io.*; import java.io.InuputStream; import java.io.IOException; public class newsmail{ public static void main(String[] args) throws IOException{ String command = "java Newsworthy_RB"; Process child = Runtime.getRuntime.exec(command); int c; ...

Database Error Handling problem in CodeIngniter

Hi, I use CodeIgniter as my web application framework. I used a simple Try/Catch and I sent a sample value to test it, and it failed! I know I can use $this->db->escape() function to solve my data problem but I just want to know: Why TRY/CATCH can not catch this error! Controler code: $this->load->model('user_model'); $result...

Get more error detail info from WCF in Silverlight client

Hey, In Silverlight client I get error but it always looks like : An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at SecretaryAppNav.ClientService.GetChildAndOpiekunByFirstnam...

How to retrieve error message from an AJAX error callback in Grails ?

I am sending the following AJAX request : $.ajax({ type: 'POST', data: $(this).parents('form:first').serialize(), url:'/myapp/comment/saveOrUpdate', success: function(data,textStatus) {insertNewComment(data)}, error: function(xhr, textStatus, errorThrown) {alert(xhr.responseText);} }) ...and my controller action looks like this ...

Error handling Symfony custom library

Hey guys, I'm writing a library that will reside in the /lib folder that deals with processing a credit/debit card transaction. I'm using the Forms framework to accept and validate the card details and then from my actions.class.php for that module, it instantiates my custom library that deals with the SOAP call to process the transacti...

Custom HTTP error page

In asp.net, I can define a custom error page like this: <configuration> <system.web> <customErrors mode="On"> <error statusCode="404" redirect="/servererrors/404.aspx" /> </customErrors> </system.web> </configuration> Now my question: If I replace, say 404.aspx with AnyHTTP.aspx, and want to get...

PHP Converting errors to exceptions design flaw

I came across some code recently that used a custom error handler to turn any PHP errors into an generalized application exception. A custom exception handler was also defined that would log the exception if it was within a particular error code range. Example: class AppException extends Exception { } function error_handler($errno, $e...

Good error handling with file_get_contents

Hello all, I am making use of simplehtmldom which has this funciton: // get html dom form file function file_get_html() { $dom = new simple_html_dom; $args = func_get_args(); $dom->load(call_user_func_array('file_get_contents', $args), true); return $dom; } I use it like so: $html3 = file_get_html(urlencode(trim("$li...

how do I catch a NSRangeException?

I want my app to continue gracefully when the online server messes up. I tried to wrap the dangerous line in a @try block. Yet it is still crashing like so: the method: + (NSArray *)findAllFor:(NSObject *)ratable { NSString *ratingsPath = [NSString stringWithFormat:@"%@%@/%@/%@%@", [self getRemoteSite], [ratable getRemo...

How to display validation error in Rails during an update operation ?

Hi, I am having a form and I am trying to save something. Whenever I hit the save button, I am running an update query in the controller. Everything works fine. I have put a validation in place for one of the text fields which takes text lengths of minimum 5. The error appears while I create the entry. However, when I try to just updat...

How to use xdebug more then backtracking an error ?

i'm using xdebug. but have no knowledge to extend its usability. I'm still using it for backtracing error only. Is there any use of xdebug ? or how do you personally use xdebug ? ...

What is the best way to associate error messages with error codes in C#?

I have a piece of software written in C#.NET that communicates with a device via USB. When a problem occurs the device sets an error code which is read by my software in the form of an integer. I want to store error messages in my C# program that correlate with the specific firmware error codes. What is the best way to store these? I ha...

How to redirect from Application_Error in ASP.NET MVC 2?

I want to show a custom error page if a user tries to upload a file larger than the maximum request length. With no code at all, I get a very mysterious "The page cannot be displayed" error when uploading a large file (not the famous yellow ASP error page) -- the same sort of browser error you get when you're offline. This strikes me as...