- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4
feat(errors): improved error handling via error classes, encpapsulation returns the condition objects #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
    
  sebffischer 
      added a commit
        to mlr-org/mlr3
      that referenced
      this pull request
    
      Aug 11, 2025 
    
    
      
  
    
      
    
  
Summary: * Depends on: mlr-org/mlr3misc#141, which makes `encapsulate()` also return the condition objects * Introduce custom error/error condition constructors (#1283) * Allows to specify for which conditions a fallback learner should be triggered (#1335) TODO: * [ ] add condition objects for warnings (varying_predict_types)
      
        
      
      
  
    5 tasks
  
              
                    mllg
  
              
              reviewed
              
                  
                    Aug 11, 2025 
                  
              
              
            
            
              
                    mllg
  
              
              reviewed
              
                  
                    Aug 11, 2025 
                  
              
              
            
            
| Should we allow to include the call? not include it for now. | 
| Maybe move the exported helper functions from mlr3 to misc to not polute the namespace | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This pull request improves errors and warnings by:
Introducing proper error classes:
Improving the formatting of error messages to include the error class. Because we now let the user react differently to different error classes (for now only during encapsulation), it's good to make the user familiar with the error class system. For formatting of errors, we use
cli, which was already a hard dependency before.Below are some examples for how error messages and warnings are now formatted:
To create the condition object, set
signal = FALSE:TODOs:
stopf(),warningf(),messagef()?--> they keep the old behavior for now. Maybe we slowly want to phase them out.
Note that
encapsulate()currently returns duplicate information, but this is only for the transition phase, see #142