Last modified: December 2013

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


AHELP for CIAO 4.11 ChIPS v1

get_error_count

Context: errors

Synopsis

Retrieves the number of instances of the specified ChIPS error type.

Syntax

get_error_count(error_type)

Description

The function arguments.

Argument Description
error_type Should the number of errors, warnings, or both be returned?

The get_error_count command retrieves the count of the number of ChIPS errors 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 single argument can take one of three values: 0, 1, or 2:

Argument Value Description
0 Show the sum of both Errors and Warnings
1 Show the count of Errors only
2 Show the count of Warnings only

The value returned is the number of errors of the requested type. Once the user issues a legal command (other than the get_error_ and set_error_ commands), the error count is reset to 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.


Example

chips> print(get_error_count(0))
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> print(get_error_count(0))
chips WARNING: The requested font (foo) has not been loaded, using
default font (helvetica)
6
chips> print(get_error_count(1))
chips WARNING: The requested font (foo) has not been loaded, using
default font (helvetica)
0
chips> print(get_error_count(2))
chips WARNING: The requested font (foo) has not been loaded, using
default font (helvetica)
6
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> print(get_error_count(0))
1
chips> print(get_error_count(1))
1
chips> print(get_error_count(2))
0

Bugs

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

See Also

errors
clear_errors, get_error_types, get_error_verbosity, get_errors, set_error_verbosity