Make the error message more meaningful by including the data and error for context.
Much more readable.  Should probably move the switch statement into a separate function.
More tests passing.  Array prefix test still failing.