change how REST api errors are handled

Process the json object into an error object if there are errors. This
is more idiomatic for node than to return true | false for the error
argument.