Interface IMixinErrorHandler
-
public interface IMixinErrorHandlerInterface for objects which want to perform custom behaviour when fatal mixin errors occur. For example displaying a user-friendly error message
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIMixinErrorHandler.ErrorActionAction to take when handling an error.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IMixinErrorHandler.ErrorActiononApplyError(java.lang.String targetClassName, java.lang.Throwable th, IMixinInfo mixin, IMixinErrorHandler.ErrorAction action)Called when an error occurs applying a mixin.IMixinErrorHandler.ErrorActiononPrepareError(IMixinConfig config, java.lang.Throwable th, IMixinInfo mixin, IMixinErrorHandler.ErrorAction action)Called when an error occurs whilst initialising a mixin config.
-
-
-
Method Detail
-
onPrepareError
IMixinErrorHandler.ErrorAction onPrepareError(IMixinConfig config, java.lang.Throwable th, IMixinInfo mixin, IMixinErrorHandler.ErrorAction action)
Called when an error occurs whilst initialising a mixin config. This allows the plugin to display more user-friendly error messages if required.By default, when a critical error occurs the mixin processor will raise a warning if the config is not marked as "required" and will throw an
Errorif it is. This behaviour can be altered by returning different values from this method.The original throwable which was caught is passed in via the
thparameter and the default action is passed in to theactionparameter. A plugin can choose to output a friendly message but leave the original behaviour intact (by returningnullor returningactiondirectly. Alternatively it may throw a different exception or error, or can reduce the severity of the error by returning a differentIMixinErrorHandler.ErrorAction.- Parameters:
config- Config being prepared when the error occurredth- Throwable which was caughtmixin- Mixin which was being applied at the time of the erroraction- Default action- Returns:
- null to perform the default action (or return action) or new action to take
-
onApplyError
IMixinErrorHandler.ErrorAction onApplyError(java.lang.String targetClassName, java.lang.Throwable th, IMixinInfo mixin, IMixinErrorHandler.ErrorAction action)
Called when an error occurs applying a mixin. This allows the plugin to display more user-friendly error messages if required.By default, when a critical error occurs the mixin processor will raise a warning if the config is not marked as "required" and will throw an
Errorif it is. This behaviour can be altered by returning different values from this method.The original throwable which was caught is passed in via the
thparameter and the default action is passed in to theactionparameter. A plugin can choose to output a friendly message but leave the original behaviour intact (by returningnullor returningactiondirectly. Alternatively it may throw a different exception or error, or can reduce the severity of the error by returning a differentIMixinErrorHandler.ErrorAction.- Parameters:
targetClassName- Class being transformed when the error occurredth- Throwable which was caughtmixin- Mixin which was being applied at the time of the erroraction- Default action- Returns:
- null to perform the default action (or return action) or new action to take
-
-