PyUpdater icon indicating copy to clipboard operation
PyUpdater copied to clipboard

Success vs tempfail vs permfail

Open RussNelson opened this issue 1 year ago • 1 comments

It can be useful to keep track of whether an upload has failed temporarily (e.g. network error) or permanently (e.g. configuration error). This would be done in Uploader.upload() where the uploader.upload_file() would return a ternary value (success, tempfail, permfail) rather than the current binary value ( complete==True is success, complete==False is tempfail, and a traceback is permfail). Further in that routine, success would result in "%s uploaded successfully", tempfail would result in adding it to the failed_uploads, and permfail wouldn't.

The advantage? A permfail wouldn't retry, wouldn't issue a trackback, _retry_upload() could be more aggressive about attempting retries.

Not suggesting that anybody else write code, just wondering if you want to move in this direction. I hate writing code that maintainers never wanted in the first place.

RussNelson avatar Aug 29 '22 21:08 RussNelson

The specific reason I suggest this is that if you configure remote_dir with an unwritable path, you get a traceback. A traceback looks like an error in the code rather than an error in the configuration. Plus, it's a lousy way to signal an error because you don't get a chance to suggest how the user might fix the code, e.g. "Unable to write to the remote_dir you configured in config.pyu.

RussNelson avatar Aug 29 '22 21:08 RussNelson