# Using the error messages that gets generated while executing

While executing code it is normal to get the messages like shdw,argx etc. I wanted to know if there is anyway i can store all these messages into a array or a variable so that i can pinpoint where the error occurred.

The scenario is that i have written few functions in webmathematica and deployed the files on the server. So in future if there are any issues with those functions i want to use the errors(messages) and convert these errors into diff user defined http requests(in turn used to send a mail containing these messages).

-
You can use $MessageList. I don't know if it works in webMathematica or how to use it in wM. – R. M. Oct 8 '13 at 13:19 ## 1 Answer In webMathematica there is already MSPGetMessage[] So if you do something like mess = MSPGetMessages[];  you have a list of messages. E.g., if you had an error for 1/0  "1\nPower::infy: Infinite expression - encountered.\n 0"  Notice that $MessageList gives just

{HoldForm[Power::infy]}

-
thanks for the answer. How do i use this mess = MSPGetMessages[]; what i intend to ask is that i have a package that has 4 to 5 functions. so i am aiming at capturing error for every function in the package. these functions are called in another package(lets call it evaluation). When i run evaluation package and if there are any errors in these functions the evaluation should stop and i should be able to use these messages to generate http – shiva Oct 9 '13 at 5:28