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

add ignore exception if flag is True #142

Closed
gsy0911 opened this issue Jan 7, 2021 · 1 comment
Closed

add ignore exception if flag is True #142

gsy0911 opened this issue Jan 7, 2021 · 1 comment

Comments

@gsy0911
Copy link
Owner

gsy0911 commented Jan 7, 2021

from functools import wraps
from logging import getLogger, INFO
import sys
import traceback


class ExceptionIgnoreDecorator:

    @classmethod
    def exception_catch(cls, function):
        @wraps(function)
        def _actual_wrapper(*args, **kwargs):
            result = None
            try:
                result = function(*args, **kwargs)
            except Exception as e:
                cls.log("="*50)
                cls.log(f"error occurred at: {function.__name__}")
                cls.log(f"{sys.exc_info()}\n{traceback.format_exc()}")
                cls.log(e)
            return result
        return _actual_wrapper
@gsy0911
Copy link
Owner Author

gsy0911 commented Jan 7, 2021

add to

def import_decorator(...):

gsy0911 added a commit that referenced this issue Jan 7, 2021
gsy0911 added a commit that referenced this issue Jan 7, 2021
gsy0911 added a commit that referenced this issue Jan 7, 2021
gsy0911 added a commit that referenced this issue Jan 7, 2021
gsy0911 added a commit that referenced this issue Jan 7, 2021
gsy0911 added a commit that referenced this issue Jan 7, 2021
@gsy0911 gsy0911 closed this as completed Jan 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant