@brimdata/zealot
Version:
The Javascript Client for Zed Lakes
22 lines (21 loc) • 497 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "parse", {
enumerable: true,
get: ()=>parse
});
class UnexpectedServerResponse extends Error {
constructor(msg){
super(msg);
this.name = "UnexpectedServerResponse";
}
}
function parse(string) {
try {
return JSON.parse(string);
} catch (e) {
throw new UnexpectedServerResponse(`Expected ndjson but received "${string}"`);
}
}