.stop_custom is a helper function for generating custom stop (error) conditions. This function was taken from Hadley Wickham's Advanced R book, 2nd edition (https://adv-r.hadley.nz/conditions.html#custom-conditions). This function should be used within custom stop functions.

.stop_custom(subclass, message, call = NULL, ...)

Arguments

subclass

A character string indicating the name of the custom error.

message

A character string with an informative message.

call

Include or not the function call that generates the error; e.g., sys.call(-1).

...

Any other argument useful to identify the source of the error and/or how to fix it.

Value

Error condition. Object of class "error", "condition", and a custom error class name (subclass).