@brimdata/zealot
Version:
The Javascript Client for Zed Lakes
17 lines (15 loc) • 336 B
text/typescript
class UnexpectedServerResponse extends Error {
constructor(msg: string) {
super(msg)
this.name = "UnexpectedServerResponse"
}
}
export function parse(string: string) {
try {
return JSON.parse(string)
} catch (e) {
throw new UnexpectedServerResponse(
`Expected ndjson but received "${string}"`
)
}
}