Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
The various techniques used for maintaining stable program state in circumstances that, if not taken care of ("handled"), could cause serious issues, including logical bugs and abrupt execution termination.
18
votes
Accepted
Populating a ListView with Items
Yeah, sure, I could just get rid of the if's and else's and replace ((Item)list...) with Item item = list... and wrap it all in a single Try{}Catch{}, but I really do hate using Try{}Catch{} unless …
12
votes
Error Handling - Controller's OnException and Application_Error
The OnException() methods does 2 things.
It logs the exception
It creates an return value
So let us refactor these two points to two separate methods.
private void LogException(ExceptionCo …
6
votes
Accepted
Find all files in directory and subdirectories while ignoring noncritical exceptions
You have multiple problems here:
For the case that an exception is thrown and swallowed you get a NullReferenceException at iterating over the filesInCurrent.
If the method would be called using …
4
votes
Lower level exception handling during enumeration
GetFilesInformation()
If there is a chance that _fileFinder.Find() throws an exception for the case that the passed in path is either null, string.Empty, non existent or invalid then you should add a …
4
votes
Reading SQL query from a resource, with error logging
Would be incorrect to expect someone to pass an ILogger even if they do not intend to use it?
If I wouldn't want to pass an ILogger I would just pass (ILogger)null and your method would throw …
3
votes
Accepted
Two similar functions for writing data to binary file using BinaryWriter
Both methods are public so I would like to suggest doing proper argument validation up front which enables you to throw the correct exceptions and return early.
Use the var type if the right hand s …
3
votes
ArrayDowncasters Implementation for Downcasting from System.Array to Array of Specific Type ...
After reading the code in question it seems every method is doing exactly the same hence I will focus only on one method and tell you what I would change:
public static int[] ToIntArray1(Array input) …
3
votes
Accepted
Showing a JDialog whenever there is an exception
At first I had two different methods for each one but now I combined
them into one.
I would have made 3 methods instead of one.
public static void showError(String errorMessage) {
show …
3
votes
Try/catch in a Tic-Tac-Toe game
I'm simply trying to catch exceptions or prevent them from being thrown in the first place.
Prevent exception from beeing thrown is in my opinion the best exception handling. So let us check w …
3
votes
Accepted
Get result from form website operation
I did that ugly try, because of NullReferenceException (if form is filled correctly, there would be no summary element, and if form is filled incorrectly, there would be no popup element).
This …
2
votes
Instantiating different kinds of error records for a database operation
Targeting only the ProcessRecord() method.
You have a flaw here, because if the given Name is not found then the resulting Collection<PSObject> from the call to ps.Invoke() won't likely contain any …
2
votes
Extract data from database and write them to file
Redundant code
In the constructor of DataExtract (which extends ConnectionUtils) you have
super(jdbcParams);
this.jdbcParams = new JdbcParams(jdbcParams);
and in the constructor of Connect …
1
vote
Returning latest database ID
By calling GetLatestDatabaseIteration(TEST_MANAGEMENTEntities managementEntity) you are not passing an object of type TEST_MANAGEMENTEntities to the method but a reference of that object to the method …