Search in sources :

Example 1 with MixinTargetAlreadyLoadedException

use of org.spongepowered.asm.mixin.transformer.throwables.MixinTargetAlreadyLoadedException in project SpongeForge by SpongePowered.

the class MixinErrorHandler method getPrettyPrinter.

public PrettyPrinter getPrettyPrinter(Throwable th) {
    if (th.getCause() instanceof ConstraintViolationException) {
        ConstraintViolationException ex = (ConstraintViolationException) th.getCause();
        Constraint constraint = ex.getConstraint();
        if ("FORGE".equals(constraint.getToken())) {
            return this.forgeVersionNotValid(constraint);
        }
        return this.patchConstraintFailed(constraint, ex);
    } else if (th instanceof MixinTargetAlreadyLoadedException) {
        return this.badCoreMod((MixinTargetAlreadyLoadedException) th);
    }
    return this.itsAllGoneHorriblyWrong();
}
Also used : Constraint(org.spongepowered.asm.util.ConstraintParser.Constraint) ConstraintViolationException(org.spongepowered.asm.util.throwables.ConstraintViolationException) MixinTargetAlreadyLoadedException(org.spongepowered.asm.mixin.transformer.throwables.MixinTargetAlreadyLoadedException)

Example 2 with MixinTargetAlreadyLoadedException

use of org.spongepowered.asm.mixin.transformer.throwables.MixinTargetAlreadyLoadedException in project SpongeForge by SpongePowered.

the class MixinErrorHandler method onPrepareError.

@Override
public ErrorAction onPrepareError(IMixinConfig config, Throwable th, IMixinInfo mixin, ErrorAction action) {
    if (action == ErrorAction.ERROR && mixin.getConfig().getMixinPackage().startsWith("org.spongepowered.")) {
        PrettyPrinter errorPrinter = this.getPrettyPrinter(th);
        String targetClassName = "N/A";
        if (th instanceof MixinTargetAlreadyLoadedException) {
            targetClassName = ((MixinTargetAlreadyLoadedException) th).getTarget();
        }
        this.appendTechnicalInfo(errorPrinter, targetClassName, th, mixin).log(this.log);
        TerminateVM.terminate("net.minecraftforge.fml", -1);
    }
    return null;
}
Also used : PrettyPrinter(org.spongepowered.asm.util.PrettyPrinter) MixinTargetAlreadyLoadedException(org.spongepowered.asm.mixin.transformer.throwables.MixinTargetAlreadyLoadedException)

Aggregations

MixinTargetAlreadyLoadedException (org.spongepowered.asm.mixin.transformer.throwables.MixinTargetAlreadyLoadedException)2 Constraint (org.spongepowered.asm.util.ConstraintParser.Constraint)1 PrettyPrinter (org.spongepowered.asm.util.PrettyPrinter)1 ConstraintViolationException (org.spongepowered.asm.util.throwables.ConstraintViolationException)1