exception-handling

Is there something known as Array type mismatch exception in C#?

My teacher has asked me to write a program in C# to handle "Array type mismatch exception". But i couldn't find anything in the net related to that. I just want to confirm if there exists something like that. ...

What to do with exceptions in repository classes?

If an error/exception occurs in a repository class, should that exception get a. caught & logged, or b. thrown to the caller (a service -- what should happen with it there?) ...

Handling RunTimeExceptions of a class

I have a class that extends Application which has a lot of methods like: public User getUser(String name); public List<User> getFriends(User user); public List<Game> getGames(User user); which wraps a service class. The catch here is that no method will work if I have no internet on the device. So for instance I am doing: public Use...

How to receive 2 or more different Exceptions?

I have written a code to add user into DB. I need to redirect to EmpInfo.jsp, when we receive duplicate entries. I need to use more Exceptions for that and also i want to know how to redirect. response.setContentType("text/html"); PrintWriter out = response.getWriter(); Connection conn = null; String url = "jdbc:mysql:/...

Unit testing with entlib - excluding catches

I've got a method that does some IO that generally looks like this: public bool Foo() { try { // bar return true; } catch (FileNotFoundException) { // recover and complete } catch (OtherRecoverableException) { // recover and complete } catch (NonRecoverableExceptio...

How to disable PHP cutting off parts of long arguments in exception stack trace?

Sometimes things like this happen: #0 /some/path(1): Class_Name->exception_trigger() #1 /some/other/path(5): get_to('/some/long/path/tha...') How to I get to see the full arguments for everything? Thanks ...

Flex: handling exceptions

I am using Flex 4 with LCDS 3. I am having problems with properly handling exceptions. I have a simple commit service like; var commitToken:AsyncToken = _serviceName.serviceControl.commit(); // Commit the change. commitToken.addResponder(new AsyncResponder( function (event:ResultEvent, token:Object=null):void { Alert.show(...

Android Exception Handling

We are converting out suite of iPhone apps written in .NEt MonoTouch to Android. How do we catch, then publish exceptions so that they are reported via the Android Market? ...

Choosing the right exception type when custom attribute is missing

I have some trouble for choosing the right type of exception to throw when an expected custom attribute is not found (I would prefer one of the existing .NET exceptions). What do you recommend in this case? Thanks in advance. Edit: Here his the context: [<ExpectedAttribute()>] let foo args ... = ... The function foo (which is user-...

Handling Exceptions in a critical application that should not crash

I have a server application which I am debugging which basically parses scripts (VBscript, Python, Jscript and SQl) for the application that requests it. This is a very critical application which, if it crashes causes havoc for a lot of users. The problem I am facing is how to handle exceptions so that the application can continue and ...

Useless stack trace in SetUnhandledExceptionFilter handler

I've been using SetUnhandledExceptionFilter for a long time, and my handler walks the stack and uses dbghelp.dll to convert the addresses into File/Line references. It then writes that to a log file and puts up a dialog with the same information for the user. This USED to work just fine. These days however I'm getting a completely useles...

Problems with custom exception in WCF Service

I've developed a service using webHttpBinding and i'm having problems with getting the StatusDescription on the client. I'm able to set the StatusCode. I've tried some code i've found through google with no success. This is the errorhandler i'm using: public class ErrorHandlerEx : IErrorHandler { public bool HandleError(Excepti...

Exception handling with WCF Data Services

I want to customize exceptions/errors thrown from my WCF Data Service, so clients get as much as possible information about what exactly went wrong/what is missing. Any thoughts on how this could be achieved? ...

How to handle JPA unique constraint violations?

When a unique constraint is violated, a javax.persistence.RollbackException is thrown. But there could be multiple reasons to throw a RollbackException. How can I find out that a unique constraint was violated? try { repository.save(article); } catch(javax.persistence.RollbackException e) { // how to find out the reason for the ...

How to handle php errors and exceptions centrally

Hi previously in PHP 4 i created a custom error handler (below) to handle my own triggered errors and general PHP errors. But now PHP 5 introduces Exceptions i.e. I'm leveraging PDO for database manipulation and I'm not sure how to handle both general PHP errors and these Exceptions? function errorHandler($errno, $errstr, $errfile, $e...

What is the difference between SqlException and SqlExecutionException?

What is the difference between SqlException and SqlExecutionException? I understand that SqlException is an exception (or warning) thrown by SqlServer itself. But in what cases the SqlExecutionException is thrown? Why it is defined under System.Web.Management namespace? ...

Catching SQL Exceptions in vb.net

Is there a way to catch all SQL exceptions in a project? I have several gridviews and multiple sqldatasources and most of the errors are going to occur when a user enters something incorrectly or in the wrong column. So how do I stop the Server Error in /Project page from showing up? ...

Workflow 4 Unhandled Exception Recovery

Is there a way to recover from an unhandled exception that doesn't involve cancelling, terminating, or aborting a Workflow? What I'd like to do is have the Workflow restart or simply log the exception if possible. My workflow is long running and hosted in a WorkflowApplication, which is in a Windows Service. As of right now, if unhandl...

Is there a way to findout what line an exception was thrown on?

Say I have a method like this: public void SaveData() { try { foreach (var somevar1 in list.SomeType1s) { CEData.SaveRow(sometype1) } foreach (var somevar2 in list.SomeType2s) { CEData.SaveRow(sometype2) } foreach (var somevar3 in list.SomeType...

What exception classes already exist and when do we use them?

In .net, c# There are many sub-classes of Exception already existing, what are they and when do we use them instead of creating our own sub-class? This question is duplicate of c# is there an exception overview ...