Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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).

share|improve this question
    
You can use $MessageList. I don't know if it works in webMathematica or how to use it in wM. –  rm -rf Oct 8 '13 at 13:19
add comment

1 Answer 1

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]}
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.