In declarative when you have a series of stages with one action outside of those stages that fails, it will cause the stage view status (the blue/red ball on the left side of the view) to show the incorrect status of the build.
Steps to reproduce:
Create a pipeline with this as the definition:
Run that code and look at the stage view to see that it appears the build was successful but it clearly failed on the build status screen on the left. Build 203 looks correct and build 204 is the one with the incorrect status indicator:
The stage view page correctly shows the build status being failed.
The biggest issue with this is that if a build fails to checkout its Jenkinsfile it will do this same thing which causes a problem where the build looks successful when it actually wasn't