Surround kvp2array with try catch