"Price Spectre"
 All Data Structures Functions Pages
Script Debugging

Price Spectre provides two ways of receiving output from custom algorithms.


The javascript throw syntax is supported. This immediately terminates the script with the specified error message. Use this on conditions that are unrecoverable.

throw 'An error has occurred';


The PS class has a public function PS::debugMessage() that is similar to throw but does not immediately terminate the script. Each call to PS::debugMessage() appends the new message to the previous ones. This is useful in cases where control flow is being observed or where multiple different bugs or errors must be tracked.

Even though execution continues after a call to PS::debugMessage() the script will still terminate with an error once execution finishes.
if(x < 0)
ps.debugMessage('x is less than 0 x = ' + x + '.');
if(y < 0)
ps.debugMessage('y is less than 0 y = ' + y + '.');