Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
MapleRaiseError - raise a Maple error in external code
MapleRaiseError1 - raise a Maple error in external code
MapleRaiseError2 - raise a Maple error in external code
Calling Sequence
MapleRaiseError(kv, msg)
MapleRaiseError1(kv, msg, arg1)
MapleRaiseError2(kv, msg, arg1, arg2)
Parameters
kv
-
kernel handle returned by StartMaple
msg
error message
arg1, arg2
Maple objects
Description
These functions are part of the OpenMaple interface to Microsoft Visual Basic.
These functions raise the Maple error described by msg, equivalent to the Maple command error(msg,arg1,arg2);.
When an error is raised, the errorCallBack is invoked, and execution continues at the next statement. OpenMaple interrupts a computation at an error invoked by MapleRaiseError when the external function is launched via MapleTrapError.
The character string msg can contain wildcards of the form %N, where N is a non-zero integer. These wildcards are replaced by the extra argument, arg1 or arg2, before displaying the message. If %-N is specified, then the optional argument is displayed with the appropriate suffix, st, nd, rd, or th, appended. For example, consider the following command.
MapleRaiseError2kv, "the %-1 argument, '%2', is not valid",
ToMapleInteger(i), args(i)
This, if invoked, raises the error, "the 4th argument, 'foo', is not valid", assuming i=4, and args(i) is set to the Maple name, foo. For more information, see error. The only option not allowed is %0 because the function cannot determine the number of unparsed optional arguments.
Examples
Sub MyGuessInput(ByVal kv As Long)
Dim i, n As Long
For i = 1 To 10
n = MapleToInteger32(kv, EvalMapleStatement(kv, "rand(-10..10)();"))
If n <= 0 Then
MapleRaiseError1 kv, "%1 is too small", ToMapleInteger(kv, n)
ElseIf n > 1 Then
MapleRaiseError1 kv, "%1 is too big", ToMapleInteger(kv, n)
End If
Next i
End Sub
See Also
OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples
Download Help Document