First - try/catch only works in Scripted Pipeline, not Declarative, so make sure you are running Scripted Pipelines or putting your try/catch code into a script
block, otherwise it won't work as you expect. If you are using Declarative, use catchError
instead.
Second, Scripted Pipeline. usesuse regular Groovy, so you would use the normal Groovy approach for this:
try {
checkout()
} catch(hudson.plugins.git.GitException e) {
// handle a GitException
} catch(hudson.AbortException e) {
// handle an AbortException
} finally {
// cleanup
}