From time to time my pipeline fails due to an HTTP request error 401, while trying to get the jenkins file from BitBucket. In this case, instead of crashing with an error message, I'd like to print a friendly error message and possibly send an email.
Is there a way to check for connectivity to the BitBucket server, before trying to run the pipeline? If this is not possible, can I catch this error somehow, and take action on it?
I'm guessing this would have to be something built into Jenkins, or on the Jenkins server, since my jenkins file resides within the repository on the BitBucket server.
An thoughts would be greatly appreciated, as I'm a Jenkins novice.