Skip to content

Provide more informative/helpful condition messages in Abort, Warn(, Inform?) #78

Open
@brookslogan

Description

@brookslogan

rlang conditions allow us to assign custom classes (allowing selective filtering), pack in relevant information within the condition object, and provide more informative traces than traceback. However, some of this functionality is not at all obvious for abort, and most/all of it is not obvious or activated for warn and inform. Plus, packing information inside the object rather than the message may actually obscure warn and inform and require an extra step for abort without some duplication inside the main message.

Help users unfamiliar with rlang conditions by:

  • Providing a short tutorial periodically when we use rlang conditions, overviewing how to view condition fields, how to get an improved trace, and how to enable these things for warn and inform when they aren't available by default (on some/all R distributions) (requiring global_entrace() first instead). Try this using inform with a .frequency.
  • Making it easy in Abort, Warn, to package in some informative objects that should be printed, and others whose names should be listed, placing them either with appropriate package-name prefixes as condition fields, or as a list condition field.
  • Consider an analogous Inform function.
  • In Abort, provide the caller's function name rather than "Error in Abort", using call parameter.
  • Tweak init to adjust the wrapping based on the actual prefixes used by rlang, e.g., "! " for abort. (Might need to know if global_entrace is active)
  • Make sure there's a way to use recover; look into what happened with this Issue.
  • Make condition class names more readily available for selective recovery? Also, maybe have length 2 or 3 subclasses that will allow to catch all errors or all conditions from this package?

Metadata

Metadata

Assignees

Labels

P2low priorityREPLImproved print, errors, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions