sdss / autoscheduler

The SDSS scheduler
1 stars 2 forks source link

try-except error #1

Open albireox opened 5 years ago

albireox commented 5 years ago

In schedule_manga the try and except clauses make it a bit complicated to debug problems, since they hide the real error. In addition, if there is an exception the usual consequence is that manga_cart_order does not get set, which triggers an error related to that in the autoscheduler output. That's quite confusing and throws you in the wrong direction when debugging.

johndonor3 commented 5 years ago

I guess the reason Ben did that was to make sure the AS didn't crash. But perhaps a crash with an appropriate error is really the desired outcome? We obviously don't except an error that needs to be caught to come up regularly. It should be easy to simply remove the try-except blocks.

albireox commented 5 years ago

I'd keep the try-except but maybe make the error message more informative. I agree that the autoscheduler should be robust and not crash. You could maybe do something like

import traceback

try:
    raise TypeError("Oups!")
except Exception, err:
    try:
        raise TypeError("Again !?!")
    except:
        pass

    traceback.print_exc()

which should print the traceback. Or you can get the text and output it to the warning system. The traceback module is quite useful.