uskudnik / amazon-glacier-cmd-interface

Command line interface for Amazon Glacier
MIT License
374 stars 100 forks source link

Fix for #67 #68

Closed wvmarle closed 12 years ago

wvmarle commented 12 years ago

Two fixes for #67: 1) evaluation of the lambda function when setting default for bookkeeping argument: must use defaults('bookkeeping')==True to have the lambda function itself run; otherwise it always evaluates to True. 2) sdb connection wrapper now immediately returns if bookkeeping is False instead of trying to make connection (and failing).

Plus added error handling to glaciercorecalls, much more useful than trying to catch AssertionError somewhere down the line.

wvmarle commented 12 years ago

afc2635 is not ready tor pulling into master; I've given it some more thought and realised that error handling should be split off to a separate module. Then both glaciercorecalls and GlacierWrapper can transparently call the same exceptions.

And too many stupid merge issues (all pretty much the same, they kept on coming back, very irritating).

offlinehacker commented 12 years ago

I agree ;)

wvmarle commented 12 years ago

So error handing is now a separate file, glacierexception.py, which integrates the original chained_exception.py code. That was interesting stuff, quite useful.

As a direct result I realised that all error handling catching GlacierException exceptions in GlacierWrapper.py is redundant, and stripped it. That cleaned up that file magnificently.

All json data responses are now logged (at debug level of course), and ValueError and if applicable KeyError exceptions are caught and handled as GlacierException.ResponseError.

Next step, another tedious one: self-tests. Especially error handling is an issue, most if not all these try/except hooks are not tested as I can't induce much in the way of errors, really.

offlinehacker commented 12 years ago

I can write tests for at least some functionality using function mocks, but this will only account for correctness of GlacierWrapper. At the same time it would be great to have some test-bench for real scenario. Will do first of that tomorrow hopefully.

On Sat, Oct 6, 2012 at 6:42 PM, wvmarle notifications@github.com wrote:

So error handing is now a separate file, glacierexception.py, which integrates the original chained_exception.py code. That was interesting stuff, quite useful.

As a direct result I realised that all error handling catching GlacierException exceptions in GlacierWrapper.py is redundant, and stripped it. That cleaned up that file magnificently.

All json data responses are now logged (at debug level of course), and ValueError and if applicable KeyError exceptions are caught and handled as GlacierException.ResponseError.

Next step, another tedious one: self-tests. Especially error handling is an issue, most if not all these try/except hooks are not tested as I can't induce much in the way of errors, really.

— Reply to this email directly or view it on GitHubhttps://github.com/uskudnik/amazon-glacier-cmd-interface/pull/68#issuecomment-9199803.