Skip to content

Commit 28200d1

Browse files
committed
Comment on future plans with r_try_catch()
1 parent 8fb2f4a commit 28200d1

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

crates/harp/src/exec.rs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ pub fn geterrmessage() -> String {
188188
}
189189
}
190190

191+
// TODO: Reimplement around `r_safe_eval()` to gain backtraces
192+
191193
/// Wrappers around R_tryCatch()
192194
///
193195
/// Takes a single closure that returns either a SEXP or `()`. If an R error is
@@ -331,25 +333,10 @@ pub unsafe fn r_try_catch<F, R>(fun: F) -> Result<RObject>
331333
where
332334
F: FnMut() -> R,
333335
RObject: From<R>,
334-
{
335-
let out = r_try_catch_any(fun);
336-
out.map(|x| RObject::from(x))
337-
}
338-
339-
pub unsafe fn r_try_catch_any<F, R>(fun: F) -> Result<R>
340-
where
341-
F: FnMut() -> R,
342336
{
343337
let vector = CharacterVector::create(["error"]);
344-
r_try_catch_finally(fun, vector, || {})
345-
}
346-
347-
pub unsafe fn r_try_catch_classes<F, R, S>(fun: F, classes: S) -> Result<R>
348-
where
349-
F: FnMut() -> R,
350-
S: Into<CharacterVector>,
351-
{
352-
r_try_catch_finally(fun, classes, || {})
338+
let out = r_try_catch_finally(fun, vector, || {});
339+
out.map(|x| RObject::from(x))
353340
}
354341

355342
/// Run closure inside top-level context

0 commit comments

Comments
 (0)