Look up the AbortException class for Jenkins. You should be able to use the methods to get back simple messages or stack traces. In a simple case, when making a call in a script block (as others have indicated), you can call getMessage() to get the string to echo to the user. Example:
script {
try {
sh "sudo docker rmi frontend-test"
} catch (err) {
echo err.getMessage()
echo "Error detected, but we will continue."
}
...continue with other code...
}