As far as I know there are no reliable unique identifiers.
There appears to be a general drift towards classed conditions, but so
far only a small subset of conditions are generated that way (and to
tell you the truth, I forget how to detect one, even though I
contributed some of them to the parser. One example (I forget whether I
wrote this one or not) is
https://github.com/r-devel/r-svn/blob/cf233857df61549b71eb466ceab7d081424833d6/src/main/gram.y#L1328
which raises an error with class c("pipebindDisabled", "parseError",
"error", "condition").
For some conditions, it might be sufficient to generate the condition
and then use (part of) the generated message as the identifier. But
that's not going to always be possible.
Duncan Murdoch
On 16/04/2023 6:56 a.m., nos...@altfeld-im.de wrote:
I am the author of the *tryCatchLog* package and want to
- suppress selected conditions (warnings and messages)
- rethrow selected conditions (e.g a specific warning as a message or to
"rename" the condition text).
I could not find any reliable unique identifier for each possible condition
- that (base) R throws
- that 3rd-party packages can throw (out of scope here).
Is there any reliable way to identify each possible condition of base R?
Are there plans to implement such an identifier ("errno")?
PS: Things that do not work good enough IMHO:
1. Just use the condition classes (not really unique to distiguish between
each and every condition))
2. Try to match the condition text
(it depends on the active language setting in R which cannot be switched "on
the fly" on each platform
and wordings or translations may even change in the future)
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel