That's not a very descriptive error message. Can you be a bit more verbose, e.g. what went wrong?
Also, I think on failure this function should return an empty string. or is this what happens below if return is 0?