Capturing Vortex Errors


If the Vortex function putmsg is defined in a script, it will be called when errors occur, instead of the errors being printed out and logged. The following variables are set when putmsg is called:

  • $errnum   A number indicating the severity and type of the error. There are several classes of errors:

    • 000-099 Errors

    • 100-199 Warnings

    • 200-299 Informational messages

    • 300+ Miscellaneous/debug messages
    Note that the error number is to be used to classify the error (e.g. whether to display it or not); it does not uniquely identify the specific error message.

  • $errscript   The URL path of the Vortex script, or the module name in square brackets, where the error occurred.

  • $errline   The source line in the script or module where the error occurred.

  • $errmsg   A text message describing the error.

  • $errfunc   The C (not Vortex) function where the error occurred; empty ("") if unknown. This is useful for technical support.

  • $errvfunc   The Vortex function where the error occurred; empty if unknown.

These variables may have several values, if more than one error occurrs at a time. The variables are reset each time putmsg is called.

This example putmsg function just saves all the messages until another function is called to print them out:

  <$savnum = $savnum $errnum>
  <$savmsg = $savmsg $errmsg>
  <$savline = $savline $errline>

The following function can then be called at an appropriate point to print out the errors, such as at the end of the script, or after a <TABLE> has been completed:

<A NAME=flushmsg PRIVATE>
  <LOOP $savnum $savmsg $savline>
    <SWITCH $savnum>
      <CASE lt 100>
      <CASE lt 200>
      <CASE lt 300>
    At line $savline: $savmsg <BR>
  <$savnum = >  <$savmsg = >  <$savline = >

By caching the messages, errors can be kept from breaking up the script's desired HTML output, yet still be printed to the user if desired. Or certain errors can be ignored altogether, such as when fetching pages from a site that might be down.

Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.