# 7 Error Handling

To demonstrate how to properly deal with misbehaving learners, mlr3 ships with the learner classif.debug:

task = mlr_tasks$get("spam") learner = mlr_learners$get("classif.debug")
print(learner)
## <LearnerClassifDebug:classif.debug>
## Parameters: list()
## Packages: -
## Predict Type: response
## Feature types: logical, integer, numeric,
##   character, factor, ordered
## Properties: missings, updates_model

The hyperparameters let us control 1. what conditions should be signaled (message, warning, error), and 2. during which stage the conditions should be signaled (train or predict).

Alternatively, we can tell the learner to provoke a segfault which tears down the complete R session. With its default settings, it will do nothing special: it learns a random label which is used to create constant predictions.