Throwing when Node doesn't have description set
Closed this issue · 0 comments
Goksi commented
When making request on /api/application/nodes/:id
, and requested node doesn't have description set, panel seems to return null for it
Example of returned node:
{
"object": "node",
"attributes": {
"id": 1,
"uuid": "b41433e2-0745-49b7-957d-0f6f1eb710db",
"public": true,
"name": "local",
"description": null,
"location_id": 1,
"fqdn": "pterodactyl.test",
"scheme": "https",
"behind_proxy": false,
"maintenance_mode": false,
"memory": 4000,
"memory_overallocate": 0,
"disk": 50000,
"disk_overallocate": 0,
"upload_size": 100,
"daemon_listen": 8080,
"daemon_sftp": 2022,
"daemon_base": "/var/lib/pterodactyl/volumes",
"created_at": "2022-07-03T18:20:49+00:00",
"updated_at": "2022-07-03T18:20:49+00:00",
"allocated_resources": {
"memory": 5024,
"disk": 3000
}
}
}
That is making json exception thrown, this is relevant code
Example of stacktrace:
org.json.JSONException: JSONObject["description"] not a string.
at org.json.JSONObject.getString(JSONObject.java:721)
at com.mattmalec.pterodactyl4j.application.entities.impl.NodeImpl.getDescription(NodeImpl.java:62)
at tech.goksi.pterobot.commands.NodeInfo.getNodeInfoEmbed(NodeInfo.kt:75)
at tech.goksi.pterobot.commands.NodeInfo.execute(NodeInfo.kt:46)
at tech.goksi.pterobot.commands.manager.abs.SimpleCommand.onSlashCommandInteraction(SimpleCommand.kt:19)
at net.dv8tion.jda.api.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:405)
at dev.minn.jda.ktx.events.CoroutineEventManager.runListener$suspendImpl(CoroutineEventManager.kt:102)
at dev.minn.jda.ktx.events.CoroutineEventManager.runListener(CoroutineEventManager.kt)
at dev.minn.jda.ktx.events.CoroutineEventManager$handle$1.invokeSuspend(CoroutineEventManager.kt:91)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)