Reputation: 9901
Mathematica by default defines a lot of useful messages for signaling common errors, like functions being called with the wrong number of arguments or files not being found. In general, I prefer to use existing, defined messages wherever possible, because it makes it easier for them to be handled via mechanisms like Check
, Quiet
and On
/Off
. However, all my attempts at finding what messages are currently defined have failed; obvious approaches like
DownValues[MessageName]
don't work at all.
Is there a trick I'm missing?
Thanks in advance.
Upvotes: 4
Views: 236
Reputation: 10695
That's a good question. In principle, you can display any messages associated with a symbol by using Messages[<symbol>]
. However, according to the documentation, the system messages are not loaded until the message is actually used. But, $MessageGroups
(new in 7) does provide a list of some of the messages available, but not nearly all.
EDIT: After some looking, I found the file $InstallationDirectory/SystemFiles/Kernel/TextResources/English/Messages.m
that appears to contain all of the system wide messages.
Upvotes: 5