# Generated by scripts/rethrow.R, do not edit by hand

rethrow_rapi_connect <- function(dual, convert_opts, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_connect(dual, convert_opts),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_disconnect <- function(conn, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_disconnect(conn),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_connection_valid <- function(conn, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_connection_valid(conn),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_startup <- function(dbdir, readonly, configsexp, environment_scan, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_startup(dbdir, readonly, configsexp, environment_scan),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_lock <- function(dual, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_lock(dual),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_unlock <- function(dual, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_unlock(dual),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_is_locked <- function(dual, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_is_locked(dual),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_shutdown <- function(dbsexp, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_shutdown(dbsexp),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_register_df <- function(conn, name, value, convert_opts, overwrite, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_register_df(conn, name, value, convert_opts, overwrite),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_unregister_df <- function(conn, name, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_unregister_df(conn, name),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_register_arrow <- function(conn, name, export_funs, valuesexp, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_register_arrow(conn, name, export_funs, valuesexp),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_unregister_arrow <- function(conn, name, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_unregister_arrow(conn, name),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_list_arrow <- function(conn, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_list_arrow(conn),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_reference <- function(rnames, alias, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_reference(rnames, alias),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_constant <- function(val, alias, convert_opts, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_constant(val, alias, convert_opts),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_operator <- function(op, exprs, alias, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_operator(op, exprs, alias),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_comparison <- function(cmp_op, exprs, alias, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_comparison(cmp_op, exprs, alias),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_function <- function(name, args, order_bys, filter_bys, alias, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_function(name, args, order_bys, filter_bys, alias),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_set_alias <- function(expr, alias, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_set_alias(expr, alias),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_tostring <- function(expr, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_tostring(expr),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_get_null_SEXP_ptr <- function(call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_get_null_SEXP_ptr(),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_from_df <- function(con, df, convert_opts, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_from_df(con, df, convert_opts),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_to_df <- function(rel, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_to_df(rel),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_sql <- function(rel, sql, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_sql(rel, sql),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_names <- function(rel, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_names(rel),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_alias <- function(rel, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_alias(rel),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_set_alias <- function(rel, alias, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_set_alias(rel, alias),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_filter <- function(rel, exprs, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_filter(rel, exprs),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_project <- function(rel, exprs, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_project(rel, exprs),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_aggregate <- function(rel, groups, aggregates, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_aggregate(rel, groups, aggregates),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_order <- function(rel, orders, ascending, nulls_first, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_order(rel, orders, ascending, nulls_first),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_expr_window <- function(window_function, partitions, order_bys, window_boundary_start, window_boundary_end, start_expr, end_expr, offset_expr, default_expr, alias, ascending, nulls_first, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_expr_window(window_function, partitions, order_bys, window_boundary_start, window_boundary_end, start_expr, end_expr, offset_expr, default_expr, alias, ascending, nulls_first),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_join <- function(left, right, conds, join, join_ref_type, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_join(left, right, conds, join, join_ref_type),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_union_all <- function(rel_a, rel_b, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_union_all(rel_a, rel_b),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_limit <- function(rel, n, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_limit(rel, n),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_distinct <- function(rel, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_distinct(rel),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_set_intersect <- function(rel_a, rel_b, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_set_intersect(rel_a, rel_b),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_set_diff <- function(rel_a, rel_b, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_set_diff(rel_a, rel_b),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_set_symdiff <- function(rel_a, rel_b, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_set_symdiff(rel_a, rel_b),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_from_sql <- function(con, sql, env, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_from_sql(con, sql, env),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_from_table <- function(con, schema_name, table_name, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_from_table(con, schema_name, table_name),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_from_table_function <- function(con, function_name, positional_parameters_sexps, named_parameters_sexps, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_from_table_function(con, function_name, positional_parameters_sexps, named_parameters_sexps),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_tostring <- function(rel, format, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_tostring(rel, format),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_to_sql <- function(rel, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_to_sql(rel),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_explain <- function(rel, type, format, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_explain(rel, type, format),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_to_parquet <- function(rel, file_name, options_sexps, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_to_parquet(rel, file_name, options_sexps),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_to_csv <- function(rel, file_name, options_sexps, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_to_csv(rel, file_name, options_sexps),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_to_table <- function(rel, schema_name, table_name, temporary, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_to_table(rel, schema_name, table_name, temporary),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_to_view <- function(rel, schema_name, view_name, temporary, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_to_view(rel, schema_name, view_name, temporary),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_insert <- function(rel, schema_name, table_name, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_insert(rel, schema_name, table_name),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_to_altrep <- function(rel, n_rows, n_cells, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_to_altrep(rel, n_rows, n_cells),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_rel_from_altrep_df <- function(df, strict, allow_materialized, wrap, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_rel_from_altrep_df(df, strict, allow_materialized, wrap),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_release <- function(stmt, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_release(stmt),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_prepare <- function(conn, query, env, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_prepare(conn, query, env),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_bind <- function(stmt, params, convert_opts, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_bind(stmt, params, convert_opts),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_execute_arrow <- function(qry_res, chunk_size, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_execute_arrow(qry_res, chunk_size),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_fetch_arrow_stream_into <- function(qry_res, stream_xptr, chunk_size, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_fetch_arrow_stream_into(qry_res, stream_xptr, chunk_size),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_fetch_arrow_array <- function(qry_res, array_xptr, schema_xptr, chunk_size, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_fetch_arrow_array(qry_res, array_xptr, schema_xptr, chunk_size),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_record_batch <- function(qry_res, chunk_size, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_record_batch(qry_res, chunk_size),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_execute <- function(stmt, convert_opts, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_execute(stmt, convert_opts),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_adbc_init_func <- function(call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_adbc_init_func(),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_ptr_to_str <- function(extptr, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_ptr_to_str(extptr),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_rapi_load_rfuns <- function(dual, call = parent.frame(2)) {
  rlang::try_fetch(
    rapi_load_rfuns(dual),
    error = function(e) {
      rethrow_error_from_rapi(e, call)
    }
  )
}

rethrow_restore <- function() {
  rethrow_rapi_connect <<- rapi_connect
  rethrow_rapi_disconnect <<- rapi_disconnect
  rethrow_rapi_connection_valid <<- rapi_connection_valid
  rethrow_rapi_startup <<- rapi_startup
  rethrow_rapi_lock <<- rapi_lock
  rethrow_rapi_unlock <<- rapi_unlock
  rethrow_rapi_is_locked <<- rapi_is_locked
  rethrow_rapi_shutdown <<- rapi_shutdown
  rethrow_rapi_register_df <<- rapi_register_df
  rethrow_rapi_unregister_df <<- rapi_unregister_df
  rethrow_rapi_register_arrow <<- rapi_register_arrow
  rethrow_rapi_unregister_arrow <<- rapi_unregister_arrow
  rethrow_rapi_list_arrow <<- rapi_list_arrow
  rethrow_rapi_expr_reference <<- rapi_expr_reference
  rethrow_rapi_expr_constant <<- rapi_expr_constant
  rethrow_rapi_expr_operator <<- rapi_expr_operator
  rethrow_rapi_expr_comparison <<- rapi_expr_comparison
  rethrow_rapi_expr_function <<- rapi_expr_function
  rethrow_rapi_expr_set_alias <<- rapi_expr_set_alias
  rethrow_rapi_expr_tostring <<- rapi_expr_tostring
  rethrow_rapi_get_null_SEXP_ptr <<- rapi_get_null_SEXP_ptr
  rethrow_rapi_rel_from_df <<- rapi_rel_from_df
  rethrow_rapi_rel_to_df <<- rapi_rel_to_df
  rethrow_rapi_rel_sql <<- rapi_rel_sql
  rethrow_rapi_rel_names <<- rapi_rel_names
  rethrow_rapi_rel_alias <<- rapi_rel_alias
  rethrow_rapi_rel_set_alias <<- rapi_rel_set_alias
  rethrow_rapi_rel_filter <<- rapi_rel_filter
  rethrow_rapi_rel_project <<- rapi_rel_project
  rethrow_rapi_rel_aggregate <<- rapi_rel_aggregate
  rethrow_rapi_rel_order <<- rapi_rel_order
  rethrow_rapi_expr_window <<- rapi_expr_window
  rethrow_rapi_rel_join <<- rapi_rel_join
  rethrow_rapi_rel_union_all <<- rapi_rel_union_all
  rethrow_rapi_rel_limit <<- rapi_rel_limit
  rethrow_rapi_rel_distinct <<- rapi_rel_distinct
  rethrow_rapi_rel_set_intersect <<- rapi_rel_set_intersect
  rethrow_rapi_rel_set_diff <<- rapi_rel_set_diff
  rethrow_rapi_rel_set_symdiff <<- rapi_rel_set_symdiff
  rethrow_rapi_rel_from_sql <<- rapi_rel_from_sql
  rethrow_rapi_rel_from_table <<- rapi_rel_from_table
  rethrow_rapi_rel_from_table_function <<- rapi_rel_from_table_function
  rethrow_rapi_rel_tostring <<- rapi_rel_tostring
  rethrow_rapi_rel_to_sql <<- rapi_rel_to_sql
  rethrow_rapi_rel_explain <<- rapi_rel_explain
  rethrow_rapi_rel_to_parquet <<- rapi_rel_to_parquet
  rethrow_rapi_rel_to_csv <<- rapi_rel_to_csv
  rethrow_rapi_rel_to_table <<- rapi_rel_to_table
  rethrow_rapi_rel_to_view <<- rapi_rel_to_view
  rethrow_rapi_rel_insert <<- rapi_rel_insert
  rethrow_rapi_rel_to_altrep <<- rapi_rel_to_altrep
  rethrow_rapi_rel_from_altrep_df <<- rapi_rel_from_altrep_df
  rethrow_rapi_release <<- rapi_release
  rethrow_rapi_prepare <<- rapi_prepare
  rethrow_rapi_bind <<- rapi_bind
  rethrow_rapi_execute_arrow <<- rapi_execute_arrow
  rethrow_rapi_fetch_arrow_stream_into <<- rapi_fetch_arrow_stream_into
  rethrow_rapi_fetch_arrow_array <<- rapi_fetch_arrow_array
  rethrow_rapi_record_batch <<- rapi_record_batch
  rethrow_rapi_execute <<- rapi_execute
  rethrow_rapi_adbc_init_func <<- rapi_adbc_init_func
  rethrow_rapi_ptr_to_str <<- rapi_ptr_to_str
  rethrow_rapi_load_rfuns <<- rapi_load_rfuns
}
