Repository navigation
Handle expansion errors during placeholder parsing - #1249
HP-network wants to merge 1 commit into
Conversation
|
Personally, I feel like it's the responsibility of the expansion to properly handle and deal with exceptions. From the PoV of PlaceholderAPI is it not expected for an expansion to throw anything on parse, but rather that this is handled gracefully and either a String or null being returned. This genuinly feels like a band-aid solution to me. |
|
Thanks for the feedback. I agree that an expansion should handle its own exceptions, but I think PlaceholderAPI still needs to treat expansion callbacks as a third-party boundary.
This change does not hide the failure: it logs the exception through the expansion logger, leaves the original placeholder unchanged (the same fallback used when no replacement is returned), and catches Would you prefer a different logging or fallback behavior, or handling this at another layer? |
A throwing expansion currently aborts the entire placeholder parse. Catch expansion exceptions, log the failing placeholder through the expansion logger, and preserve the original token so later placeholders can still be processed.
Adds a regression test for the failure path. Fixes #1107.