I need to write a program that uses an alternate algorithm when the algorithm first attempted is taking too long. Here is a minimal example.
foo[n_Integer]:=CheckAbort[TimeConstrained[soln=FactorInteger[n],3],{{n,1}}];
foo[140]
(* {{2,2},{5,1},{7,1}} *)
The example above did what I expected. However, in the next example FactorInteger requires more than three seconds. In that case I wanted foo to return {{n,1}} where (n=10^100+3). Instead I get $Aborted.
foo[10^100+3]
(* $Aborted *)
How do I get foo to do what I wanted.