Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

WISH: Add support for p(condition = <error>|<interrupt>)

Đang mở
#199 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
r
Lĩnh vực
api

Hướng nghiên cứu

The payload names no source files. Start from the two examples: the tryCatch version and the version where progressr reports the error, and check how a progressor call currently handles a condition. The proposed change is that calling p(condition = e) from an error handler leaves the progress bar open with the message. The maintainer has not chosen a design yet, so agree on the API with them before writing code. Done means the first example keeps the bar visible after the caught error.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature request

(This came out of Discussion #196)

When there are errors, we can either handle them manually, e.g.

with_progress({
  p <- progressor(10)
  tryCatch({
    for (kk in seq_along(p)) {
      Sys.sleep(0.1)
      if (kk == 3) stop("boom")
      p()
    }
  }, error = function(e) {
    message("Caught an error")
  })
})
#> Caught an error

or let progressr take care of it for us, e.g.

with_progress({
  p <- progressor(10)
  for (kk in seq_along(p)) {
    Sys.sleep(0.1)
    if (kk == 3) stop("boom")
    p()
  }
})
#>   ■■■■■■■                           20% |  ETA:  1s
#>  Progress interrupted by simpleError condition: boom
#>  Error in withVisible(expr) : boom

What's missing, is that in the first case, we have no way to tell the progressr framework that we detected an error and we wish to the progress reporter to not close the progress bar, i.e. we want to leave something like:

#>   ■■■■■■■                           20% |  ETA:  1s
#> Caught an error

Idea

One idea could be to add support for signalling condition as in:

p <- progressor(10)
tryCatch({
  for (kk in seq_along(p)) {
    if (kk == 3) stop("boom")
    p()
  }
}, error = function(e) {
  p(condition = e) # tell the progressor about the error we just caught
  message("Caught an error")
})
Ngôn ngữ chính
R
Star
299
Fork
11
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của futureverse/progressr

Tất cả issue của futureverse/progressr

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.