Skip to content

transition warning to error when predicting from a failed model fit #1184

Open
@simonpcouch

Description

@simonpcouch

There's a good bit of this throughout the source:

parsnip/R/predict_raw.R

Lines 18 to 21 in 8af5ddf

if (inherits(object$fit, "try-error")) {
cli::cli_warn("Model fit failed; cannot make predictions.")
return(NULL)
}

A couple thoughts:

  1. This warning likely ought to be an error.
  2. We can set parent = object$fit so that the model fit error is surfaced as part of the message.
  3. This pattern should live inside of a helper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upkeepmaintenance, infrastructure, and similar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions