gatsby-source-sanity
Version:
Gatsby source plugin for building websites using Sanity.io as a backend.
18 lines • 558 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var through = require("through2");
function filter(sanityDoc, enc, callback) {
var doc = sanityDoc;
if (doc._id && doc._type) {
callback(null, doc);
return;
}
var error = sanityDoc;
if (error.statusCode && error.error) {
callback(new Error(error.statusCode + ": " + error.error));
return;
}
callback();
}
exports.rejectOnApiError = function () { return through.obj(filter); };
//# sourceMappingURL=rejectOnApiError.js.map