refactor remove extra print parameter

Should not print the err when it is nil.
We need to handle err outside this function.