Maybe it is just a different way? Your function returns an error code if something goes wrong.