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

Improve Error Handling and Logging #64

Open
thisisayush opened this issue Jan 14, 2018 · 2 comments
Open

Improve Error Handling and Logging #64

thisisayush opened this issue Jan 14, 2018 · 2 comments
Assignees

Comments

@thisisayush
Copy link
Collaborator

Error Handling in Spiders needs to be improved, here is what's needed to be changed:

  • Replace from scrapeNews.pipelines import loggerError with from scrapeNews.settings import logger (loggerError has been removed)
  • Replace all loggerError.error("Your Message") with logger.error(__name__ + " Your Message ")
  • Wrap All Methods inside a main try..except block
try:
...
except Exception as e:
    logger.error(__name__ + " [UNHANDLED] : " + str(e) + " : " + response.url)
  • Use [UNHANDLED] in error message when catching General Errors (i.e catching Exception instead of a particular error)
  • Wisely Use self.urls_* variables to reduce inconsitency in stats.
@vipulgupta2048
Copy link
Owner

vipulgupta2048 commented Jan 15, 2018

  • A thing you need to ask yourself before posting issue. Try it sometimes.
  1. WHAT (Change logging)
  2. WHY (Didn't mention)
  3. Where (Easy to figure it out)
  • Until you post reasons, hypothesis, opinions about what you are trying to achieve. Will never get across to people. Don't presume that people would know every intention that you have for a particular task that you want to accomplish.

I will let the comminity decide that.

@thisisayush
Copy link
Collaborator Author

WHAT? (Mentioned in title)
Why? (Improvement, mentioned in title)
WHERE? (Described quite well)

Reason being current error handling is very fragile, a single exception can make spider to end which isn't supposed to happen. Read the codes and changes made on sone spiders to see exactly the difference.

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

No branches or pull requests

6 participants