Skip to content
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

Fix: Error parsing mouse pest from Elite API #2967

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

ptlthg
Copy link
Contributor

@ptlthg ptlthg commented Nov 20, 2024

What

Fixes properties from the Elite API being parsed directly to CropType/PestType which makes them error intolerant.

This was technically "fixed" already in the newest beta since the mouse got added to PestType, but this change still makes it more error tolerant anyways.

SkyHanni 0.28.Beta.13: Error loading user farming weight
Loading the farming weight data from elitebot.dev failed!
You can re-enter the garden to try to fix the problem.
If this message repeats, please report it on Discord
 
Caused by com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: No valid pest type 'mouse'
	at com.google.gson.Gson.fromJson(Gson.java:803)
	at com.google.gson.Gson.fromJson(Gson.java:868)
	at SH.features.garden.farming.FarmingWeightDisplay.loadWeight(FarmingWeightDisplay.kt:608)
	at SH.features.garden.farming.FarmingWeightDisplay.access$loadWeight(FarmingWeightDisplay.kt:43)
	at SH.features.garden.farming.FarmingWeightDisplay$update$1.invokeSuspend(FarmingWeightDisplay.kt:176)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by java.lang.IllegalStateException: No valid pest type 'mouse'
	at SH.features.garden.pests.PestType$Companion.getByName(PestType.kt:103)
	at SH.utils.json.SkyHanniTypeAdapters.PEST_TYPE$lambda$11(SkyHanniTypeAdapters.kt:77)
	at SH.utils.json.SimpleStringTypeAdapter.read(SimpleStringTypeAdapter.kt:17)
	at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)

Changelog Fixes

  • Fixed loading farming weight errors caused by the Mouse Pest. - Ke5o

@github-actions github-actions bot added the Bug Fix Bug fixes label Nov 20, 2024
@hannibal002 hannibal002 added this to the Version 0.28 milestone Nov 20, 2024
@hannibal002 hannibal002 merged commit a8ebc47 into hannibal002:beta Nov 23, 2024
8 checks passed
@github-actions github-actions bot removed the Bug Fix Bug fixes label Nov 23, 2024
@ptlthg ptlthg deleted the fix/mouse_pest_in_elite_api branch November 25, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants