Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Print a labeled message from ResourceFunction with contexts hidden
ResourceFunction["ResourceFunctionMessage"][symbol::tag] prints the message symbol::tag unless it has been switched off. | |
ResourceFunction["ResourceFunctionMessage"][symbol::tag,e1,e2,…] prints a message, inserting the values of the ei as needed. |
Issue a message:
| In[1]:= |
Define a function to issue a message and return unevaluated upon an error:
| In[2]:= |
Define the message:
| In[3]:= |
| In[4]:= |
| Out[4]= |
| In[5]:= |
| Out[5]= |
Here’s a function that prints a message for invalid inputs:
| In[6]:= | ![]() |
| In[7]:= |
| Out[7]= |
| In[8]:= |
| Out[8]= |
When printing messages from a ResourceFunction, symbols can appear with lengthy contexts:
| In[9]:= |
| Out[9]= |
| In[10]:= |
| Out[10]= |
Using ResourceFunctionMessage instead of Message will attach the message to ResourceFunction and add a formatted label:
| In[11]:= |
| In[12]:= |
| Out[12]= |
| In[13]:= |
| Out[13]= |
Use Quiet to prevent ResourceFunctionMessage from printing messages:
| In[14]:= |
| Out[14]= |
Suppress specific messages:
| In[15]:= |
| Out[15]= |
If a message is undefined, a placeholder template is used:
| In[16]:= |
This is similar to the behavior of Message:
| In[17]:= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License