* Add length check for the return string * Differentiate error paths and logging messages * Rectify error message