f::args="`1` is not a prorper table.";
SetAttributes[f,HoldAll]
f[tab_/;ListQ[ReleaseHold@tab]===False]:=Message[f::args,HoldForm@tab]
f[tab_]:=ListPlot[ReleaseHold@tab]
g=Table[{i,i^2},{i,10}];
In this code I want to ListPlot
only proprly defined tables. If I run f[g[[2;;,{1,2}]]]
this gives expected plot. But if I by mistake type
f[g[[2;;{1,2}]]]
this gives error message from Part
and also my message from f
, but I want in this error case to see only message from f
and no messages from Mathematica functions. How to make f
to behave this way?
Thanks.