vtsuperdarn / davitpy

DEPRECATED The DaViT Python project
http://vtsuperdarn.github.com/davitpy/
GNU General Public License v3.0
37 stars 59 forks source link

[Critical Bug] Broken Exception Handling #244

Closed asreimer closed 8 years ago

asreimer commented 8 years ago

Since we made the changes over to the logging module in the last release, there are now problems with our exception handling. Specifically, if there is an exception one gets another exception, so you don't get to see what the original exception problem (hooray!). This is what has been happening in #241 and #238, I was just too dense earlier to realize it.

"TypeError: coercing to Unicode: need string or buffer, exceptions.TypeError found" and "cannot concatenate 'str' and 'exceptions.ImportError' objects"

We need a hotfix for this ASAP. I'm going to work on it now.

asreimer commented 8 years ago

The second error is easily fixed by converting the exception to a string. For example:

try:
    print h
except Exception, e:
    logging.warn('PROBLEM: ' + e)

Fails, but this

try:
    print h
except Exception, e:
    logging.warn('PROBLEM: ' + str(e))

Works. I'm converting all of these types of statements to include the explicit str() conversion.

ksterne commented 8 years ago

Merged it into master and created pull back to develop to resync with #247.