nansat
nansat copied to clipboard
Standardize return values on failure/success
For the most part, it seems that methods return 1 on failure and 0 on success.
Node.node() returns False on fail (if node is not found). Which is completely opposite as False corresponds to 0.
Some methods just return (with no value), e.g. Nansat.reproject with dstDomain=None
I believe this should be standardize throughout the whole of nansat.
Any seconds for that, and I can assign myself to this.
agree!
On 16 October 2015 at 15:30, Aleksander Vines [email protected] wrote:
For the most part, it seems that methods return 1 on failure and 0 on success.
Node.node() returns False on fail (if node is not found). Which is completely opposite as False corresponds to 0.
Some methods just return (with no value), e.g. Nansat.reproject with dstDomain=None
I believe this should be standardize throughout the whole of nansat.
Any seconds for that, and I can assign myself to this.
— Reply to this email directly or view it on GitHub https://github.com/nansencenter/nansat/issues/146.
Job schedulers (on big computers) usually handle STDERR errors well (proper message handling is not so obvious when everything just goes to the screen); just saying...
see also http://stackoverflow.com/questions/5574702/how-to-print-to-stderr-in-python from future import print_function def warning(*objs): print("WARNING: ", *objs, file=sys.stderr)
This issue is relevant to #54 but is more general. Closing #54 ...
I agree with @aleksandervines Note of @rickedanielson is more relevant for how to raise errors and output warnring/error messages. This is currently done using children of Exception and self.logger.error() or self.logger.warning()
For some methods it may conflict with #164. Fix is required only for the methods which will not return Nansat