Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/chips/ahelp/get_error_types.html
Jump to: Description · Example · Bugs · See Also


AHELP for CIAO 4.11 ChIPS v1

get_error_types

Context: errors

Synopsis

Retrieves the types of ChIPS errors collected.

Syntax

get_error_types()

Description

The get_error_types command retrieves the type errors/warnings which have occured since the last legal ChIPS command. This command is part of the advanced ChIPS module; refer to "ahelp chips" for information. To load the module:

from pychips.advanced import *

The value returned can take one of four values: 0, 1, 2 or 3:

Argument Value Description
0 There are no Errors or Warnings
1 There are only Errors
2 There are only Warnings
3 There are both Errors and Warnings

The value returned is the type of errors, if any exist. Once the user issues a legal command (other than the get_error_ and set_error_ commands), the error count is reset to zero, and so the response of this command will be zero. The error statistics collected refer to ChIPS internal error only. For example, if the user mispells an attribute, this will count as a ChIPS error. If the user mispells a ChIPS command, Python will return an error saying the command is not defined, and this will not be counted in the error count, and therefore a get_error_types command will return zero.


Example

chips> print(get_error_types())
0
chips> add_label(0.5, 0.5, 'FOO', 'font=foo')
chips WARNING: The requested font (foo) has not been loaded, using
default font (helvetica)
chips> e = get_error_types()
chips WARNING: The requested font (foo) has not been loaded, using
default font (helvetica)
chips> print(e)
2
chips> set_preference("curve.err.right", "tre")
chips ERROR: The curve.err.right value (tre) must be one of
[t|f|true|false|on|off|1|0|yes|no]
chips> e = get_error_types()
chips> print(e)
1

get_error_types() is issued on a clean startup of ChIPS and the expected value of zero is returned. Next an add_label command is issued with a non-existant font. This generates warnings as shown by the subsequent get_error_types command. Next, an invalid set_preference command, with an incorrect attribute value, is issued to Chips. This results in an error. get_error_types responds with a one.


Bugs

See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

See Also

concepts
setget
errors
clear_errors, get_error_count, get_error_verbosity, get_errors, set_error_verbosity
utilities
set_current