Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions R/console.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ console <- function() {
type,
"tk" = .igraph.progress.tk(percent, message),
"tkconsole" = .igraph.progress.tkconsole(percent, message),
stop("Cannot interpret 'verbose' option, this should not happen")
cli::cli_abort(
"Unknown value for the {.arg verbose} option.",
.internal = TRUE
)
)
}
}
Expand All @@ -103,7 +106,10 @@ console <- function() {
type,
"tk" = message(message, appendLF = FALSE),
"tkconsole" = .igraph.progress.tkconsole.message(message, start = TRUE),
stop("Cannot interpret 'verbose' option, this should not happen")
cli::cli_abort(
"Unknown value for the {.arg verbose} option.",
.internal = TRUE
)
)
}
0L
Expand Down
6 changes: 3 additions & 3 deletions R/interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ add_edges <- function(graph, edges, ..., attr = list()) {
attrs <- append(attrs, attr)
nam <- names(attrs)
if (length(attrs) != 0 && (is.null(nam) || any(nam == ""))) {
stop("please supply names for attributes")
cli::cli_abort("All attributes must be named.")
}

edges.orig <- ecount(graph)
Expand Down Expand Up @@ -213,7 +213,7 @@ add_vertices <- function(graph, nv, ..., attr = list()) {
attrs <- append(attrs, attr)
nam <- names(attrs)
if (length(attrs) != 0 && (is.null(nam) || any(nam == ""))) {
stop("please supply names for attributes")
cli::cli_abort("All attributes must be named.")
}

vertices.orig <- vcount(graph)
Expand Down Expand Up @@ -354,7 +354,7 @@ neighbors <- function(graph, v, mode = c("out", "in", "all", "total")) {

v <- as_igraph_vs(graph, v)
if (length(v) == 0) {
stop("No vertex was specified")
cli::cli_abort("{.arg v} must specify at least one vertex.")
}

neighbors_impl(
Expand Down
6 changes: 3 additions & 3 deletions R/iterators.R
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ simple_es_index <- function(x, i, na_ok = FALSE) {
cli::cli_abort("Invalid indexing.")
}
if (is.null(get_vs_graph(x))) {
stop("Graph is unknown.")
cli::cli_abort("Graph is unknown.", .internal = TRUE)
}
value
}
Expand All @@ -1170,10 +1170,10 @@ simple_es_index <- function(x, i, na_ok = FALSE) {
!"name" %in% names(attributes(value)) ||
!"value" %in% names(attributes(value))
) {
stop("Invalid indexing.")
cli::cli_abort("Invalid indexing.")
}
if (is.null(get_es_graph(x))) {
stop("Graph is unknown.")
cli::cli_abort("Graph is unknown.", .internal = TRUE)
}
value
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ test_that("neighbors works", {

test_that("neighbors prints an error for an empty input vector", {
g <- make_tree(10)
expect_error(neighbors(g, numeric()), "No vertex was specified")
expect_error(neighbors(g, numeric()), "at least one vertex")
})


Expand Down
Loading