Omgili - forum search, search forums  
  

Discussions about catch

Displaying 1 - 10 out of 500,415 discussions.  
Time Frame: (Any time)   Minimum number of replies: (2)   Minimum number of discussing users: (0)
  |  

Page: 1   2   3   4   5   6   7   8   9   10  
Keep this page open to be updated with the newest discussions automatically.
Any ideas on this one? I'm trying to write a unit test that will delete an item and confirm that item is no longer in a repository by trying to retrieve the item by its ID which should throw a DataAccessException. However, the test keeps failing. I added...
Started by on , 4 posts by 4 people.  
[TestMethod] [ExpectedException....
The VS Unit Test Framework will only look for an ExpectedException attribute at the entry point of a particular test .
You need to add the ExpectedException attribute onto the same method which has the TestMethod attribute .
In c++, Iam trying to catch all types of exceptions in one catch (like catch(Exception) in C#). how is it done ? and more, how can one catch devide-by-zero exceptions ?
Started by on , 8 posts by 8 people.  
catch(...) will also ....
} Important considerations: A better approach is to catch specific types of exception that you can actually recover from as opposed to all possible exceptions.
catch (...) { // Handle exceptions not covered.
Which one should I use? catch (_com_error e) or catch (_com_error& e)
Started by on , 5 posts by 5 people.  
Try { throw MyException....
Here is my attempt at quoting Sutter "Throw by value, catch by reference" Here's MyException ("error") } catch (Exception e) { /* Implies: Exception e (MyException ("error by not copying the exception.
The second.
Ask your Facebook Friends
In the try catch block is it bad practice to return values from the catch block in C++? try { //Some code... return 1; } catch(...) { return 0; } Which method of using try/catch is good practice?
Started by on , 5 posts by 5 people.  
Write: int rc = 1; try { // some code } catch(...) { rc = 0; } return rc; I find it easier to debug on the end of the function, after the try/catch block..
What is the difference between try { } catch { throw; } and try { } catch(Exception e) { throw e;} and when should i use one or another?
Started by on , 7 posts by 7 people.  
You would normally use....
You should use try { } catch(Exception e) { throw } if you want to do stack trace.
catch (Exception ex) { throw new Exception("Additional information...", ex); } There's a blog post discussing the differences.
I have question about throw. How will the throw work in the following code? Does the catch block return false? try { //code } catch(Exception ex) { throw; return false; }
Started by on , 4 posts by 4 people.  
If your client code looks something be doing this instead: try { bankAccount... .
Let's assume your try/catch is in a BankAccount class.
The return false is never reached at the same time .
Somewhere up the call stack needs to catch it.
No, it rethrows.
Possible Duplicate: Why catch and rethrow Exception in C#? I sometimes come across C# code that looks like this: try { // Some stuff } catch (Exception e) { throw e; } I understand its possible to do something like log the exception message and then rethrow...
Started by on , 13 posts by 13 people.  
But this is often used to do other things in the catch the exact same exception: catch (Exception) { throw; } Whereas this rethrows the exception without the original stack trace: catch....
Not if you do nothing else in the catch...
Hi We recently had a problem with a Java server application where the application was throwing Errors which were not caught because Error is a separate subclass of Throwable and we were only catching Exceptions. We solved the immediate problem by catching...
Started by on , 15 posts by 15 people.  
An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch Normally when programming, you should....
That indicates conditions that a reasonable application might want to catch.
I have often come across situations like :- try{ ... stmts ... } catch(Exception ex) { ... stmts ... } finally { connection.close // throws an exception } which still needs a try - catch block inside finally. What is the best practice to overcome this...
Started by on , 8 posts by 8 people.  
Write a SQLUtils class that contains static closeQuietly methods ... .
} finally { connection.close(): } } catch before the catch but I think it solves the problem you were trying to solve.
Stmts ...
I usually did it this way: try { try { . .
I have some PHP code that should cause and catch two exceptions: try{ @$this->connector->connect(); // Suppress the default warning (doesn't effect 'throw') } catch(BadArgumentException $e) {} // Works, no error, following code executes. try{ @$...
Started by on , 3 posts by 3 people.  
OK I found out it was a namespacing problem: it seems PHP doesn't complain when you try and use a non-existant namespaced element (in this case use Framework\AuthenticationException when really I needed use Framework\Connector\AuthenticationException ... .
Page: 1   2   3   4   5   6   7   8   9   10  
Related Searches
- Catch the Fall    fair catch    catch    Try-Catch    HOW TO CATCH RAIKOU    Catching up    clear catch midstream    the best way how to catch raikou    ways to catch raikou    Can I catch yeast from my dog   
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost