GSoC: Week 7: with ErrorHandler()

Niraj-Kamdar
Published: 07/12/2020

What did I do this week?

This week my mentor has pointed out several issues in my InputEngine PR and I fixed those this week.I have fixed Issue: Use patterns in VERSION_PATTERNS as valid CONTAINS_PATTERNS by default and for that I have changed checker metaclass to include VERSION_PATTERNS by default as valid CONTAINS_PATTERNS. I also changed mapping test data of all checkers and removed redundant CONTAINS_PATTERNS. I have also fixed Escape sequence issue. I have also created an error_handler module which provides ErrorHandler context manager. It will display colorful traceback and set custom exit code. Currently, It supports four different modes for error handling:

  1. TruncTrace - displays truncated traceback (default)
    • trucated traceback output
  2. FullTrace - displays full traceback (when logging level is debug can be set via -l debug option)
    • Full traceback output
  3. NoTrace - displays no traceback (when logging level is critical can be set via -q(--quiet) flag)
    • no traceback output
  4. Ignore - Ignore any raised Exception (Only used internally.)

I have moved all custom exception in error_handler module so that it would be easy to assign error code. I have also changed excepthook to display colorized output traceback. I have also changed unittest for cli and input_engine to incorporate changes in exception handling.  If one raise error without context manager he will get full traceback regardless of mode he set. So, always use ErrorHandler context manager to raise exception or around the code that can raise exception.

What am I doing this week? 

I am going to improve InputEngine and Extractor modules this week.

Have I got stuck anywhere?

I wanted to improve InputEngine this week but Ideas discussed in issue related to the other functionalities of InputEngine aren't clear so I wanted to discuss future plans for InputEngine in this week's meeting but unfortunately mentors were busy this week so meeting got canceled but terriko has opened issues regarding exceptions and I got an idea to colorize traceback and extend functionality of custom error codes for every modules so I have done that instead and as you can see it looks awesome now.

 

 

1000 characters left