fabric-loader icon indicating copy to clipboard operation
fabric-loader copied to clipboard

Specify full entrypoint name on crash

Open SHsuperCM opened this issue 1 year ago • 5 comments

Due to the way I use entrypoints in my projects I tend to encounter entrypoint crashes often while developing. The current logging makes it hard to distinguish which entrypoint is being problematic at a glance.

This small change in fabric loader specifies in the log the exact entrypoint that caused the game to crash.

Essentially changes:

 java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'minecraft-test'!
	at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388) ~[main/:?]

into:

 java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'minecraft-test->(0.3.x)net.fabricmc.minecraft.test.TestEntrypoint::makeCrashPlz'!
	at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388) ~[main/:?]

SHsuperCM avatar May 06 '24 12:05 SHsuperCM

I also dont really know the importance of the (0.3.x) in the new entry's toString so I didnt remove it in this commit until I know more about it and if it is safe to remove.

SHsuperCM avatar May 06 '24 12:05 SHsuperCM

Before this gets merged, I want to reiterate that I would like to get rid of the (0.3.x) as it doesnt add much and could lead to confusion with mod versions. But I am unsure of how it would be best to do so.

Ideally it could just be removed from https://github.com/FabricMC/fabric-loader/blob/12775fdfe9eb7a0b1e260acf1e27aeb80c930543/src/main/java/net/fabricmc/loader/impl/entrypoint/EntrypointStorage.java#L107

as I'm pretty sure the distinction is no longer relevant in this version but you guys probably know more if that marking is still needed.

SHsuperCM avatar Jun 08 '24 15:06 SHsuperCM

Before this gets merged, I want to reiterate that I would like to get rid of the (0.3.x) as it doesnt add much and could lead to confusion with mod versions. But I am unsure of how it would be best to do so.

Ideally it could just be removed from

https://github.com/FabricMC/fabric-loader/blob/12775fdfe9eb7a0b1e260acf1e27aeb80c930543/src/main/java/net/fabricmc/loader/impl/entrypoint/EntrypointStorage.java#L107

as I'm pretty sure the distinction is no longer relevant in this version but you guys probably know more if that marking is still needed.

I see yes, I dont think thats needed at all. seems fine to remove to me. I need to take a proper look at this exisitng code in an IDE before approving the change. It seems fine on the surface though.

modmuss50 avatar Jun 08 '24 16:06 modmuss50

I think it'd be nicer to keep the current phrasing and only add the location at the end ([...]by <modid> at <entry.value>), minimizing the reliance on toString's implementation.

Player3324 avatar Jun 09 '24 00:06 Player3324

I think it'd be nicer to keep the current phrasing and only add the location at the end ([...]by <modid> at <entry.value>), minimizing the reliance on toString's implementation.

By all means, I made the PR to be as minimally invasive on the API as possible so I used what was already there. I used the toString because it seems like referencing the entry by a string is implementation specific and not something required by the entrypoint container itself. (also why I opted for entrypoint "name" rather than "definition")

SHsuperCM avatar Jun 09 '24 04:06 SHsuperCM

Added the requested phrasing. I'm pretty sure this does not break api as entrypoint storages are impl.

SHsuperCM avatar Jul 14 '24 05:07 SHsuperCM