This util method checks whether the input string is a valid hex string, so make sure we return a GError on failure.