Science is not a white/black min/max field. Failure in science is to end up not knowing more about why your original idea or theory is either wrong or right. It's the literal equivalent to a sealed glass of water containing the same exact (to the molecule) amount of volume after a period of time attempting to change it through external forces. You've learned nothing.
When a rocket explodes on a launch pad, and you've gathered petabytes of telemetry data and sensory data from all of it's systems, you can study and research that data to figure out what went wrong and put procedures and systems in place to mitigate that in the future. You learn from the mistakes, thus the outcome of the failure is a success. This doesn't mean we should stand in the viewing area of SpaceX's control center and cheer them on for their work in making a rocket explode. They still failed their mission, but they can make their future missions more safe and more robust because of what they learned in a real world failure situation.