Skip to main content
Hi Community,



I have been looking into the AIMMS error handling feature. During this, the function errh::Category got my attention. This function has an element parameter with range errh::AllPendingErrors as input, and it returns the error category in the range of the predefined set errh::AllErrorCategories.



The set errh::AllErrorCategories contains these possible categories: Engine, Internal, Authorization, Licensing, Memory, Limit, Compiler, Syntax, Semantics, Legacy, Execution, Math, InvalidArgument, Unit, IO, External, Generation, MathematicalProgramming, NonlinearEvaluation, Solver, GUI and User.



Some examples of how AIMMS classifies errors using the categories are these:




  • When assigning a value of 2 to an identifier with a Binary range, the category is Semantics
  • Doing a division by zero resulted in a Math error

What I want is to use these categories in order to control the errors that AIMMS displays by default and to show a user-friendly message to the end-user. For instance, when I executed a procedure with a zero division the AIMMS message was "Execution error while evaluating the assignment statement for "lpBinaryRange" on line 13 in user-defined function section "procTestLog".Division by zero error with 1 / 0." but what I want the user to see is "Math error, please contact your development team".



The problem that I have is that I didn´t find a list that relates the categories with the most common errors.



I hope my description is understandable. I would be very thankful for any information or support.



Thanks,

Jorge
@Jorge Guede , please correct me if I understood your use case wrong but wouldn't it work for if you do something like below in your error handling procedures ?



Have a string parameter indexed over IndexErrorCategories, say spErrorMessage(IndexErrorCategories).



The data of this will be



spErrorMessage('Math') = "Math error, please contact your development team"



and in your error handling,



DisplayDialog(spErrorMessage(errh::ErrorCategory(error)).



So, you will display the pre determined message (by category) based on the category of the error that occurs.
@Jorge Guede are you aware of the following example ?



https://www.aimms.com/english/developers/resources/examples/functional-examples/error-handling/



"This example contains a generic library called 'Error Handler' that can be used in any AIMMS application to offer a user friendly way for end-users to report any unexpected AIMMS errors to the application developer."




A very good library was developed for this exact purpose 😉You can go pretty wild with this.

Tell me if you need more help to use it !
Hi @Jorge Guede just wanted to check back - did you find the help you needed in this thread, or maybe you found another solution you could share with us? It might help others to know 🙂
Hi



Sorry for the delay of my answer.



@mohansx I see your point but what we wanted to know is a list of examples or an explanation of which errors occur and in what category. For instance, the error category Execution occurs when there is wrong code or when there is a memory overflow. The objective is to give the users a more detailed message than the predetermined message.



@Arthur that is one of the sources of information that I checked and you are right, it is quite good! The experimentation with that library gave rise to the question that is described in this topic.



Thank you for your answers.



Best, Jorge
@Jorge Guede , if you look under the Progress, errors & warnings sections of the Options menu, you will find the warnings categories.




Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator