How do you detect different types of thrown splash potions? or any thrown item?

i'm trying to detect when a specific type of potion is thrown, such as fire resistance, so i can kill the potion and give the player certain effects. How would i go about detecting and killing the potion? i've looked at a similar question, only to find out it was from 2015.


Note that dropped items are different from thrown potions.

1.13+

Use /execute if entity to detect the thrown potion and run a command.

/execute if entity @e[type=potion,nbt={Potion:{tag:{Potion:"minecraft:fire_resistance"}}}] run setblock 1 2 3 stone

Replace setblock 1 2 3 stone with your desired command.

1.12-

Use /testfor to detect the thrown potion and run a command.

/testfor @e[type=potion] {Potion:{tag:{Potion:"minecraft:fire_resistance"}}}