import { assertObject } from "../../shared/src/asserts.js";
import { isClientStateNotFoundResponse, assertVersionNotSupportedResponse } from "./error-responses.js";
import { assertHTTPRequestInfo } from "./http-request-info.js";
function assertPusherResult(v) {
  assertObject(v);
  assertHTTPRequestInfo(v.httpRequestInfo);
  if (v.response !== void 0) {
    assertPushResponse(v.response);
  }
}
function assertPushResponse(v) {
  if (isClientStateNotFoundResponse(v)) {
    return;
  }
  assertVersionNotSupportedResponse(v);
}
class PushError extends Error {
  name = "PushError";
  // causedBy is used instead of cause, because while cause has been proposed as a
  // JavaScript language standard for this purpose (see
  // https://github.com/tc39/proposal-error-cause) current browser behavior is
  // inconsistent.
  causedBy;
  constructor(causedBy) {
    super("Failed to push");
    this.causedBy = causedBy;
  }
}
export {
  PushError,
  assertPusherResult
};
//# sourceMappingURL=pusher.js.map
