Handle different error classes for malformed JSON

Older Chef versions used Yajl, newer use FFI_Yajl, without
this fix the rescue statement raises an undefined constant
error.