|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Exception Handling
Although we would not like to be having exceptions at this stage in code, it happens. I was wondering weather other programmers catch exceptions or let them stop the code? Any help will really make my teams life much easier.
Lenny |
|
#2
|
||||
|
||||
|
Re: Exception Handling
I believe in catching errors and handling them rather than letting them crash code. Especially if you know what could cause them to happen.
This year a major example is our RaspberryPi, which we are using to process camera images. We them pipe the data back to the cRIO via TCP Socket. There will be times where something goes wrong and I will get an IOException, and I would rather have it handled gracefully and keep the robot running rather than it crash. |
|
#3
|
|||
|
|||
|
Re: Exception Handling
In our code base, we catch certain kinds of errors - anything that we know could be thrown (for example IOException or NumberFormatException) we will catch.
Most of the time, we don't try to catch exceptions if we don't know they'll be thrown - it's not useful to us to try to catch ArrayIndexOfOfBoundsException or NullPointerException, because generally they imply that there's a bug in our code that should be fixed. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|