NASA-DEVELOP / VOCAL

Visualization of CALIPSO (VOCAL). A CALIPSO Cross Cutting tool for visualizing data
http://nasa-develop.github.io/VOCAL/
Other
38 stars 14 forks source link

Exception not caught within log #88

Closed Syntaf closed 8 years ago

Syntaf commented 8 years ago

Any exceptions that occur within the program are not forwarded to the log, this is not desired. We want exceptions to be outputted to the log as well. You can reproduce this by raising any sort of exception manually, then running the program and checking the log after the exception occurs. Here's an example from inside Calispo.py within __init__

class Calipso(object):
    """
    Main class of the application, handles all GUI related events as well as
    creating other GUI windows such as the toolbar or import dialog
    """

    ############################################################
    #   Initialization functions

    def __init__(self, r):

        raise ValueError('catch me!')  # throw exception

        self.load_img = ImageTk.PhotoImage(file=PATH + '/ico/load.png')
        self.save_img = ImageTk.PhotoImage(file=PATH + '/ico/save.png')
        self.__root = r  # Root of program
        self.__file = ''  # Current file in use
        self.xrange = self.yrange = (0, 1000)  # X and Y range for scrolling plot
        self.panx = self.pany = 0  # Pan values for shifting map
        self.plot = Plot.baseplot  # Current selected plot
        self.__label_file_dialog = None
        self.new_file_flag = False
        self.option_menu = None
        self.shape_var = StringVar()

        self.width = self.__root.winfo_screenwidth()
        self.height = self.__root.winfo_screenheight()

The console output will be:

[2016-03-04 12:43:12,539] [    INFO] --- Instantiating DatabaseManager... (db.py:111)
[2016-03-04 12:43:12,887] [    INFO] --- Tag found... (db.py:135)
[2016-03-04 12:43:12,888] [    INFO] --- Found unique tag 20... (db.py:138)
[2016-03-04 12:43:12,891] [    INFO] --- Starting CALIPSO program... (Calipso.py:679)
[2016-03-04 12:43:12,934] [    INFO] --- Instantiate CALIPSO program... (Calipso.py:682)
[2016-03-04 12:43:12,934] [   ERROR] --- Uncaught exception: catch this!... (log.py:43)
None
Traceback (most recent call last):
  File "C:/Users/Grant/Documents/GitHub/vocal/calipso/Calipso.py", line 699, in <module>
    main()
  File "C:/Users/Grant/Documents/GitHub/vocal/calipso/Calipso.py", line 683, in main
    program = Calipso(rt)
  File "C:/Users/Grant/Documents/GitHub/vocal/calipso/Calipso.py", line 55, in __init__
    raise ValueError('catch this!')
ValueError: catch this!

Process finished with exit code 1

however the log will be:

[2016-03-04 12:43:12,539] [    INFO] --- Instantiating DatabaseManager... (db.py:111)
[2016-03-04 12:43:12,887] [    INFO] --- Tag found... (db.py:135)
[2016-03-04 12:43:12,888] [    INFO] --- Found unique tag 20... (db.py:138)
[2016-03-04 12:43:12,891] [    INFO] --- Starting CALIPSO program... (Calipso.py:679)
[2016-03-04 12:43:12,934] [    INFO] --- Instantiate CALIPSO program... (Calipso.py:682)
[2016-03-04 12:43:12,934] [   ERROR] --- Uncaught exception: catch this!... (log.py:43)
None

So we're not catching the exception

Syntaf commented 8 years ago

Impl under https://github.com/Syntaf/vocal/pull/94