text: "use strict";
  
  module.exports = line => {
    try {
      return JSON.parse(line);
    } catch (err) {
      // Catch half-done lines with an error at the end
      var errorPosition = line.lastIndexOf('{"error":');
  
      if (errorPosition === -1) {
        err.message = "".concat(err.message, " (").concat(line, ")");
        throw err;
      }
  
      var errorJson = line.slice(errorPosition);
      var errorLine = JSON.parse(errorJson);
      var error = errorLine && errorLine.error;
  
      if (error && error.description) {
        throw new Error("Error streaming dataset: ".concat(error.description, "\n\n").concat(errorJson, "\n"));
      }
  
      throw err;
    }
  };