QuiltMC / quilt-loader

The loader for Quilt mods.
Apache License 2.0
472 stars 87 forks source link

Make Error Messages Clearer #444

Open OroArmor opened 3 months ago

OroArmor commented 3 months ago

Massively improves the error messages reported by loader.

Example improvement:

mod-resolving-tests-normal breaks all versions of mod-resolving-tests-broken, which is present!

- - <mods>/normal.jar
+ Breaking mods: 
+ - Mandatory mod 'mod-resolving-tests-normal' version '1.0.0': <mods>/normal.jar
+
+ Broken mods: 
+ - Mandatory mod 'mod-resolving-tests-broken' version '1.0.0': <mods>/broken.jar

Additional improvements:

Full improvements to error messages:
Breaks:
```diff mod-resolving-tests-normal breaks all versions of mod-resolving-tests-broken, which is present! -- /normal.jar +Breaking mods: +- Mandatory mod 'mod-resolving-tests-normal' version '1.0.0': /normal.jar + +Broken mods: +- Mandatory mod 'mod-resolving-tests-broken' version '1.0.0': /broken.jar ``` ![image](https://github.com/user-attachments/assets/d1755c37-7862-47c2-b828-8365aa8b62c5)
Breaks Unless:
```diff mod_a breaks all versions of mod_b, which is present! +However, if any version of mod_c is present, mod_a does not break mod_b. -- /mod_a.jar +Breaking mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar + +Broken mods: +- Mandatory mod 'mod_b' version '1.0.0': /mod_b.jar ``` ![image](https://github.com/user-attachments/assets/a8b36442-a498-45c9-bbe8-323b2abdb5be)
Breaks on Broken Optional with an Unless:
```diff -- Error 1 -- -Unhandled solver error involving the following rules: -Rule 1: -Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} on mod_d versions [*] (1 breaking options, 0 okay options) - x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_d' from /mod_d.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_d' from /mod_d.jar} -Rule 2: -Mandatory mod mod_d (mod_d) v1.0.0 -Rule 3: -Dependency for at line 10 column 18 path $.quilt_loader.breaks[0].unless on mod_b versions [*] (1 valid options, 0 invalid options) - + {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} -Rule 4: -Mandatory mod mod_c (mod_c) v1.0.0 -Rule 5: -Mandatory mod mod_a (mod_a) v1.0.0 -Rule 6: -Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from /mod_a.jar} on mod_c versions [*] (1 breaking options, 0 okay options) - x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from /mod_c.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from /mod_c.jar} +mod_b breaks all versions of mod_d, which is present! +Breaking mods: +- Required optional mod 'mod_b' version '1.0.0': /mod_a.jar/mod_b.jar + +Broken mods: +- Mandatory mod 'mod_d' version '1.0.0': /mod_d.jar + + +-- Error 2 -- + +mod_a breaks all versions of mod_c, which is present! +Normally, any version of mod mod_b overrides this break, but it is unable to load due to another error. + +Breaking mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar + +Broken mods: +- Mandatory mod 'mod_c' version '1.0.0': /mod_c.jar + +Overriding mods: +- Required optional mod 'mod_b' version '1.0.0': /mod_a.jar/mod_b.jar ``` ![image](https://github.com/user-attachments/assets/119abc82-a914-4974-94ef-845442b960cb)
Breaks with Unless Any:
```diff mod_a breaks all versions of mod_b, which is present! +However, if any of the following are present, mod_a does not break. +- Any version of mod_c which is missing. +- Any version of mod_d which is missing. -- /mod_a.jar +Breaking mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar + +Broken mods: +- Mandatory mod 'mod_b' version '1.0.0': /mod_b.jar ``` ![image](https://github.com/user-attachments/assets/0050b42f-d89a-48db-8347-a1a2d09a8b1f)
Depends on any with an invalid option:
```diff -- Error 1 -- mod_b requires any version of mod_d, which is missing! -- /mod_b.jar +Requiring mods: +- Required mandatory mod 'mod_b' version '1.0.0': /mod_b.jar + + +-- Error 2 -- + +mod_a depends on any of the following mods: +- Any version of mod_b: + Satisfying mods which cannot load: + - Required mandatory mod 'mod_b' version '1.0.0': /mod_b.jar + +- Any version of mod_c, which is missing! + +Requiring mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar ``` ![image](https://github.com/user-attachments/assets/52377f32-72e3-4f13-834c-dfaee1feeb6a)
Depends on an invalid mod that also provides an existing mod:
```diff -- Error 1 -- -Unhandled solver error involving the following rules: -Rule 1: -Dependency for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from /mod_a.jar} on mod_b versions [=1.0.0] (1 valid options, 1 invalid options) - + {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} - x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_b.jar} -Rule 2: -optional mod 'mod_b' (2 sources) - - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} - - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_b.jar} -Rule 3: -Mandatory mod mod_b (mod_b) v2.0.0 -Rule 4: -Mandatory mod mod_a (mod_a) v1.0.0 +mod_a requires a version [1.0.0, 1.0.0] of mod_b, which is unable to load due to another error! +Requiring mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar + +Satisfying mods: +- Required optional mod 'mod_b' version '1.0.0': /mod_a.jar/mod_b.jar + +Invalid mods: +- Mandatory mod 'mod_b' version '2.0.0': /mod_b.jar + + +-- Error 2 -- + +Duplicate mandatory mod ids [mod_c] +- Mandatory mod 'mod_c' version '1.0.0': /mod_c.jar +- Provided optional mod 'mod_c' version '1.0.0' from mod 'mod_b' (/mod_a.jar/mod_b.jar): /mod_a.jar/mod_b.jar + + +-- Error 3 -- + +Duplicate mandatory mod ids [mod_b] +- Required optional mod 'mod_b' version '1.0.0': /mod_a.jar/mod_b.jar +- Mandatory mod 'mod_b' version '2.0.0': /mod_b.jar ... |--------------|--------------|---------------|--------------|-------|-------------------|----------------------------| | Quilt Loader | quilt_loader | 0.26.4-beta.1 | !missing! | | | | | mod_a | mod_a | 1.0.0 | quilt_loader | .. | | \mod_a.jar | -| mod_b | mod_b | 1.0.0 | quilt_loader | .. | | \mod_a.jar\mod_b.jar | | mod_b | mod_b | 2.0.0 | quilt_loader | .. | | \mod_b.jar | | mod_b | mod_b | 1.0.0 | quilt_loader | .. | | \mod_a.jar\mod_b.jar | +| mod_b | mod_c | 1.0.0 | quilt_loader | .. | | \mod_a.jar\mod_b.jar | | mod_c | mod_c | 1.0.0 | quilt_loader | .. | | \mod_c.jar | |--------------|--------------|---------------|--------------|-------|-------------------|----------------------------| ``` ![image](https://github.com/user-attachments/assets/37cae188-b6ba-449f-9eae-1af88cac9730)
Depends on a mod that provides an existing mod:
```diff -- Error 1 -- -Unhandled solver error involving the following rules: -Rule 1: -Dependency for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from /mod_a.jar} on mod_b versions [*] (1 valid options, 0 invalid options) - + {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} -Rule 2: -optional mod 'mod_c' (2 sources) - - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_a.jar/mod_b.jar} - - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from /mod_c.jar} -Rule 3: -Mandatory mod mod_a (mod_a) v1.0.0 -Rule 4: -Mandatory mod mod_c (mod_c) v1.0.0 +Duplicate mandatory mod ids [mod_c] +- Provided optional mod 'mod_c' version '1.0.0' from mod 'mod_b' (/mod_a.jar/mod_b.jar): /mod_a.jar/mod_b.jar +- Mandatory mod 'mod_c' version '1.0.0': /mod_c.jar +-- Error 2 -- + +mod_a requires any version of mod_b, which is unable to load due to another error! + +Requiring mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar + +Satisfying mods: +- Required optional mod 'mod_b' version '1.0.0': /mod_a.jar/mod_b.jar + ... | Quilt Loader | quilt_loader | 0.26.4-beta.1 | !missing! | | | | | mod_a | mod_a | 1.0.0 | quilt_loader | .. | | \mod_a.jar | | mod_b | mod_b | 1.0.0 | quilt_loader | .. | | \mod_a.jar\mod_b.jar | -| mod_b | mod_b | 1.0.0 | quilt_loader | .. | | \mod_a.jar\mod_b.jar | +| mod_b | mod_c | 1.0.0 | quilt_loader | .. | | \mod_a.jar\mod_b.jar | | mod_c | mod_c | 1.0.0 | quilt_loader | .. | | \mod_c.jar | |--------------|--------------|---------------|--------------|-------|-------------------|----------------------------| ``` ![image](https://github.com/user-attachments/assets/2e080870-9ae7-4e89-a1cb-64ce54267006)
Depends on a missing mod:
```diff mod-resolving-tests-main requires any version of mod-resolving-tests-library, which is missing! -- /main.jar +Requiring mods: +- Mandatory mod 'mod-resolving-tests-main' version '1.0.0': /main.jar ``` ![image](https://github.com/user-attachments/assets/d4cf6b43-f4c6-4d11-90d0-752e2858f847)
Depends on a mod with an array version:
```diff -mod-resolving-tests-main requires version [1.19-alpha.22.24.a, 2) of minecraft, which is missing! +mod-resolving-tests-main requires a version [1.19-alpha.22.24.a, 2) of minecraft. -- /mod.jar +Requiring mods: +- Mandatory mod 'mod-resolving-tests-main' version '1.0.0': /mod.jar + +Invalid mods: +- Required optional mod 'minecraft' version '1.18.2': /minecraft.jar ``` ![image](https://github.com/user-attachments/assets/66245d1d-71e5-4a6e-9d64-393c90c3a8da)
Depends on a mod which breaks another mod:
```diff -- Error 1 -- mod_b breaks all versions of mod_c, which is present! -- /mod_b.jar +Breaking mods: +- Required mandatory mod 'mod_b' version '1.0.0': /mod_b.jar + +Broken mods: +- Mandatory mod 'mod_c' version '1.0.0': /mod_c.jar + + +-- Error 2 -- + +mod_a requires any version of mod_b, which is unable to load due to another error! + +Requiring mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar + +Satisfying mods: +- Required mandatory mod 'mod_b' version '1.0.0': /mod_b.jar ``` ![image](https://github.com/user-attachments/assets/99d655b2-2abc-42a2-ab3f-310327af35cc)
Depends on a mod broken by another mod:
```diff -- Error 1 -- -Unhandled solver error involving the following rules: -Rule 1: -optional mod 'mod_a' (1 source) - - {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from /mod_a.jar} -Rule 2: -Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_c' from /mod_c.jar} on mod_b versions [*] (1 breaking options, 0 okay options) - x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_b.jar} -Rule 3: -Dependency for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_a' from /mod_a.jar} on mod_b versions [*] (1 valid options, 0 invalid options) - + {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_b.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'mod_b' from /mod_b.jar} -Rule 4: -Mandatory mod mod_c (mod_c) v1.0.0 +mod_a requires any version of mod_b, which is unable to load due to another error! +Requiring mods: +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar + +Satisfying mods: +- Required mandatory mod 'mod_b' version '1.0.0': /mod_b.jar + + +-- Error 2 -- + +mod_c breaks all versions of mod_b, which is present! + +Breaking mods: +- Mandatory mod 'mod_c' version '1.0.0': /mod_c.jar + +Broken mods: +- Required mandatory mod 'mod_b' version '1.0.0': /mod_b.jar ``` ![image](https://github.com/user-attachments/assets/97f38559-df1b-46ba-9039-04100c556611)
Depends on a mod that provides an existing mod
```diff -- Error 1 -- Duplicate mandatory mod ids [mod_a] -- /mod_a.jar -- /mod_b.jar +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar +- Provided mandatory mod 'mod_a' version '1.0.0' from mod 'mod_b' (/mod_b.jar): /mod_b.jar ... |--------------|--------------|---------------|--------------|-------|-------------------|------------------| | Quilt Loader | quilt_loader | 0.26.4-beta.1 | !missing! | | | | | mod_a | mod_a | 1.0.0 | quilt_loader | .. | | \mod_a.jar | -| mod_b | mod_b | 1.0.0 | quilt_loader | .. | | \mod_b.jar | +| mod_b | mod_a | 1.0.0 | quilt_loader | .. | | \mod_b.jar | | mod_b | mod_b | 1.0.0 | quilt_loader | .. | | \mod_b.jar | | mod_c | mod_c | 1.0.0 | quilt_loader | .. | | \mod_c.jar | |--------------|--------------|---------------|--------------|-------|-------------------|------------------| ``` ![image](https://github.com/user-attachments/assets/7acb4a63-b63b-49e0-aba5-9a114a0dd696)
Duplicate mods:
```diff Duplicate mandatory mod ids [mod_a] -- /mod_a-v1.jar -- /mod_a-v2.jar +- Mandatory mod 'mod_a' version '1.0.0': /mod_a-v1.jar +- Mandatory mod 'mod_a' version '2.0.0': /mod_a-v2.jar ``` ![image](https://github.com/user-attachments/assets/fd94fca7-9184-4e4f-b0f5-c1ec5a14970b)
Breaks on all:
```diff -- Error 1 -- -Unhandled solver error involving the following rules: -Rule 1: -Dependency for at line 13 column 24 path $.quilt_loader.breaks[0][0].unless on part_3 versions [*] (0 valid options, 0 invalid options) -Rule 2: -Breakage for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'normal' from /normal.jar} on all of: - - at line 10 column 12 path $.quilt_loader.breaks[0][0] - - at line 18 column 12 path $.quilt_loader.breaks[0][1] -Rule 3: -Mandatory mod normal (normal) v1.0.0 -Rule 4: -Breakage for at line 10 column 12 path $.quilt_loader.breaks[0][0] on part_1 versions [*] (1 breaking options, 0 okay options) - x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_1' from /part_1.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_1' from /part_1.jar} -Rule 5: -Mandatory mod part_2 (part_2) v1.0.0 -Rule 6: -Mandatory mod part_1 (part_1) v1.0.0 -Rule 7: -Breakage for at line 18 column 12 path $.quilt_loader.breaks[0][1] on part_2 versions [*] (1 breaking options, 0 okay options) - x {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_2' from /part_2.jar} {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'part_2' from /part_2.jar} +normal breaks because all of the following are present: +- Any version of part_1: + However, if any version of part_3 is present, normal does not break part_1. + Matching mods: + - Mandatory mod 'part_1' version '1.0.0': /part_1.jar +- Any version of part_2: + Matching mods: + - Mandatory mod 'part_2' version '1.0.0': /part_2.jar + +Breaking mods: +- Mandatory mod 'normal' version '1.0.0': /normal.jar ``` ![image](https://github.com/user-attachments/assets/e864075b-2cbc-4318-8a0a-61aea3448417)
Depends on any:
```diff -Unhandled solver error involving the following rules: -Rule 1: -Mandatory mod normal (normal) v1.0.0 -Rule 2: -Dependency for at line 9 column 22 path $.quilt_loader.depends[0][1] on part_2 versions [*] (0 valid options, 0 invalid options) -Rule 3: -Dependency for at line 9 column 12 path $.quilt_loader.depends[0][0] on part_1 versions [*] (0 valid options, 0 invalid options) -Rule 4: -Dependancy for {org.quiltmc.loader.impl.plugin.quilt.QuiltModOption 'normal' from /normal.jar} on any of: - - at line 9 column 12 path $.quilt_loader.depends[0][0] - - at line 9 column 22 path $.quilt_loader.depends[0][1] +normal depends on any of the following mods: +- Any version of part_2, which is missing! +- Any version of part_1, which is missing! +Requiring mods: +- Mandatory mod 'normal' version '1.0.0': /normal.jar ``` ![image](https://github.com/user-attachments/assets/0407b4dd-dc81-4813-8efc-ab2a7175fc82)
Provides existing mod:
```diff Duplicate mandatory mod ids [mod_a] -- /mod_a.jar -- /mod_b.jar +- Mandatory mod 'mod_a' version '1.0.0': /mod_a.jar +- Provided mandatory mod 'mod_a' version '1.0.0' from mod 'mod_b' (/mod_b.jar): /mod_b.jar ``` ![image](https://github.com/user-attachments/assets/17c91102-6bfd-4fd5-b540-8d23796a3083)