Logging upload cancellations

Also refactored some error code handling - converted some defines to class methods.