Skip to content

Catch the bad status line exception and log it#239

Merged
rnevet merged 2 commits into
BitBotFactory:masterfrom
laxdog:badStatusLine
Feb 21, 2017
Merged

Catch the bad status line exception and log it#239
rnevet merged 2 commits into
BitBotFactory:masterfrom
laxdog:badStatusLine

Conversation

@laxdog

@laxdog laxdog commented Feb 21, 2017

Copy link
Copy Markdown
Collaborator

Polo sometimes return a bad error code we can't parse. This catches that exception.

Description

Fixes #205

TESTING STAGE

Tested

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read CONTRIBUTING.md
  • I fully understand Github Flow.
  • My code adheres to the code style of this project.
  • [N/A] I have updated the documentation in /docs if I have changed the config, arguments, logic in how the bot works, or anything that understandably needs a documentation change.
  • [N/A] I have updated the config file accordingly if my change requires a new configuration setting or changes an existing one.
  • I have tested the bot with no issues for 24 continuous hours. If issues were experienced, they have been patched and tested again.

@Evanito Evanito added the Queued label Feb 21, 2017
@rnevet

rnevet commented Feb 21, 2017

Copy link
Copy Markdown
Collaborator
  1. It's not so clear why this needs special handling. (to prevent sleep?)
  2. I'm not sure the handling is complete without persisting the status. (i.e. log.persistStatus())

I would suggest just adding:
elif isinstance(ex, BadStatusLine): // ignore
In the exception handler.

@laxdog

laxdog commented Feb 21, 2017

Copy link
Copy Markdown
Collaborator Author
  1. No reason. I actually thought they were separated because the first ones were catching the class and the others were using the string.
  2. I didn't realise that was required either.

Changed and pushed.

@rnevet

rnevet commented Feb 21, 2017

Copy link
Copy Markdown
Collaborator

Looks good to me, a bit of testing and it can be merged.

@rnevet rnevet merged commit b534479 into BitBotFactory:master Feb 21, 2017
@rnevet rnevet removed the Queued label Feb 21, 2017
Comment thread lendingbot.py
exit(1)
elif 'timed out' in ex.message:
print "Timed out, will retry in " + str(Lending.get_sleep_time()) + "sec"
elif isinstance(ex, BadStatusLine):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it go as a except BadStatusLine:?

@rnevet rnevet Feb 21, 2017

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could, but then we would need to duplicate the entire error logic that is in except Exception: already. (i.e. logging, status persisting, sleep)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BadStatusLine: Requesting returnLoanOrders

4 participants