Throwing exception if the path isnt a string or array