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

Issue 213: Empty loot in Lootsplitter throws exception #280

Conversation

Veritania
Copy link

No description provided.

@MikeJeffers
Copy link

Another PR already! 😋

@Veritania
Copy link
Author

Yep! It's fun to explore :)

LootGenerator.cs L15-L18
If a null is passed to the LootGenerator here, do we prefer to silently correct the mistake and set it to an empty list, or would you prefer something like throw new PerpetuumException(ErrorCodes.LootItemNotFound); or another/new ErrorCode instead?

@Veritania Veritania marked this pull request as ready for review March 15, 2021 15:00
@MikeJeffers
Copy link

Yep! It's fun to explore :)

LootGenerator.cs L15-L18
If a null is passed to the LootGenerator here, do we prefer to silently correct the mistake and set it to an empty list, or would you prefer something like throw new PerpetuumException(ErrorCodes.LootItemNotFound); or another/new ErrorCode instead?

No, the case to throw an error would typically be in a response handler (or the callstack of one) such that the error is returned to the client to inform the player (think: 400+ web codes)

The case this PR is actually solving is something that just throws in the course of a server-side thread when generating loot - which aborts a big transaction too rolling back everything about the kill unrelated to the loot generation. It only happens when a boss does loot splitting, but still and error worth handling so the rest of the kill transaction can proceed and commit. There might be a boss npc with no loot.. who knows.

Copy link

@MikeJeffers MikeJeffers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@MikeJeffers MikeJeffers merged commit ad78cfe into OpenPerpetuum:Development Mar 17, 2021
@Veritania Veritania linked an issue Mar 22, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty loot on lootsplitter throws exception
2 participants