CheckAbort
CheckAbort[expr, failexpr] evaluates expr, returning failexpr if an abort occurs.
Examples
Handle an abort:
CheckAbort[Abort[], "Aborted!"]
(* "Aborted!" *)Normal evaluation without abort:
CheckAbort[1 + 2, "Aborted"]
(* 3 *)Please visit the official Wolfram Language Reference for more details.