Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch pallet initialization errors #65

Closed
stdavis opened this issue Jun 14, 2016 · 5 comments · Fixed by #67
Closed

Catch pallet initialization errors #65

stdavis opened this issue Jun 14, 2016 · 5 comments · Fixed by #67
Labels

Comments

@stdavis
Copy link
Member

stdavis commented Jun 14, 2016

Steps to reproduce

  1. Run a pallet that raises an exception in __init__

Expected behavior

I would expect forklift to complete successfully and show the error raised for that pallet.

Actual behavior

Forklift chokes and crashes without processing any subsequent pallets.

I think that we should probably wrap this code in a try/except. On except we may need to create a fake pallet with the appropriate success tuple.

@stdavis stdavis added the bug label Jun 14, 2016
@steveoh
Copy link
Member

steveoh commented Jun 14, 2016

def global_exception_handler(ex_cls, ex, tb):
        import traceback

        last_traceback = (traceback.extract_tb(tb))[-1]
        line_number = last_traceback[1]
        file_name = last_traceback[0].split(".")[0]

        logger.log(traceback.format_exception(ex_cls, ex, tb), stdout=testing)

        mailman.deliver('crash-db error', logger.print_log())

        if testing:
            traceback.print_exception(ex_cls, ex, tb)

            logger.log(logger.print_log(), stdout=testing)

            logger.log(("line:%s (%s)" % (line_number, file_name)), stdout=testing)

    sys.excepthook = global_exception_handler

We could do something like this in forklift so we get notified of areas that crash the entire process.

@steveoh steveoh mentioned this issue Jun 14, 2016
@steveoh
Copy link
Member

steveoh commented Jun 16, 2016

What are your thoughts on moving all errorable logic out of __init__ and into a new method that forklift can manage better and invoke when necessary? Something like build or create.

@stdavis
Copy link
Member Author

stdavis commented Jun 16, 2016

How would that make it easier on forklift? Would we still need the try/except around that method?

@steveoh
Copy link
Member

steveoh commented Jun 16, 2016

yes but it would be out of the cli method to just add a pallet to a list and into the lift method where the processing would be happening.

@stdavis
Copy link
Member Author

stdavis commented Jun 16, 2016

That's fine with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants