You are looking at historical revision 14083 of this page. It may differ significantly from its current revision.

check-errors

Argument checks, errors & conditions.

Documentation

Conditions

(require-extension conditions)

make-exn-condition

[procedure] (make-exn-condition LOCATION MESSAGE ARGUMENTS) => PROPERTY-CONDITION

LOCATION is a symbol.

MESSAGE is a string.

ARGUMENTS is a list.

LOCATION, MESSAGE and ARGUMENTS maybe #f.

Returns an exn property-condition with optional location, message and arguments properties.

make-exn-condition+

[procedure] (make-exn-condition+ LOCATION MESSAGE ARGUMENTS [CONDITION...]) => PROPERTY-CONDITION

LOCATION, MESSAGE and ARGUMENTS as make-exn-condition.

CONDITION is a:

property-condition
literal
symbol
(make-property-condition <symbol>)
list
(apply make-property-condition <list>)

Returns a composite-condition exn CONDITION....

condition-predicate*

[procedure] (condition-predicate* TAG) => PROCEDURE/1

Returns a "memioized" condition-predicate for TAG.

make-condition-predicate

[syntax] (make-condition-predicate TAG...) => PROCEDURE/1

Returns a condition-predicate for TAG....

Type Errors

(require-extension type-errors)

error-argument-type

[procedure] (error-argument-type LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

TYPE-NAME and ARGUMENT-NAME are string.

Raises a type-error where is message is constructed from the TYPE-NAME and optional ARGUMENT-NAME.

Example:

(error-argument-type 'foo obj "integer" "count")
;=> "bad `count' argument - expected an integer"

error-type-fixnum

[procedure] (error-type-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-positive-fixnum

[procedure] (error-type-positive-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-cardinal-fixnum

[procedure] (error-type-cardinal-fixnum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-flonum

[procedure] (error-type-flonum LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-integer

[procedure] (error-type-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-positive-integer

[procedure] (error-type-positive-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-cardinal-integer

[procedure] (error-type-cardinal-integer LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-number

[procedure] (error-type-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-positive-number

[procedure] (error-type-positive-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-cardinal-number

[procedure] (error-type-cardinal-number LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-procedure

[procedure] (error-type-procedure LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-input-port

[procedure] (error-type-input-port LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-output-port

[procedure] (error-type-output-port LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-list

[procedure] (error-type-list LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-pair

[procedure] (error-type-pair LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-blob

[procedure] (error-type-blob LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-vector

[procedure] (error-type-vector LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-structure

[procedure] (error-type-structure LOCATION OBJECT TAG [ARGUMENT-NAME])

error-type-symbol

[procedure] (error-type-symbol LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-keyword

[procedure] (error-type-keyword LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-string

[procedure] (error-type-string LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-char

[procedure] (error-type-char LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

error-type-boolean

[procedure] (error-type-boolean LOCATION OBJECT TYPE-NAME [ARGUMENT-NAME])

Type Checks

(require-extension type-checks)

When the unsafe feature is defined the check procedures are no-ops.

check-fixnum

[procedure] (check-fixnum LOCATION OBJECT [ARGUMENT-NAME])

check-positive-fixnum

[procedure] (check-positive-fixnum LOCATION OBJECT [ARGUMENT-NAME])

check-cardinal-fixnum

[procedure] (check-cardinal-fixnum LOCATION OBJECT [ARGUMENT-NAME])

check-flonum

[procedure] (check-flonum LOCATION OBJECT [ARGUMENT-NAME])

check-integer

[procedure] (check-integer LOCATION OBJECT [ARGUMENT-NAME])

check-positive-integer

[procedure] (check-positive-integer LOCATION OBJECT [ARGUMENT-NAME])

check-cardinal-integer

[procedure] (check-cardinal-integer LOCATION OBJECT [ARGUMENT-NAME])

check-number

[procedure] (check-number LOCATION OBJECT [ARGUMENT-NAME])

check-positive-number

[procedure] (check-positive-number LOCATION OBJECT [ARGUMENT-NAME])

check-cardinal-number

[procedure] (check-cardinal-number LOCATION OBJECT [ARGUMENT-NAME])

check-procedure

[procedure] (check-procedure LOCATION OBJECT [ARGUMENT-NAME])

check-input-port

[procedure] (check-input-port LOCATION OBJECT [ARGUMENT-NAME])

check-output-port

[procedure] (check-output-port LOCATION OBJECT [ARGUMENT-NAME])

check-list

[procedure] (check-list LOCATION OBJECT [ARGUMENT-NAME])

check-pair

[procedure] (check-pair LOCATION OBJECT [ARGUMENT-NAME])

check-blob

[procedure] (check-blob LOCATION OBJECT [ARGUMENT-NAME])

check-vector

[procedure] (check-vector LOCATION OBJECT [ARGUMENT-NAME])

check-structure

[procedure] (check-structure LOCATION OBJECT TAG [ARGUMENT-NAME])

check-symbol

[procedure] (check-symbol LOCATION OBJECT [ARGUMENT-NAME])

check-keyword

[procedure] (check-keyword LOCATION OBJECT [ARGUMENT-NAME])

check-string

[procedure] (check-string LOCATION OBJECT [ARGUMENT-NAME])

check-char

[procedure] (check-char LOCATION OBJECT [ARGUMENT-NAME])

check-boolean

[procedure] (check-boolean LOCATION OBJECT [ARGUMENT-NAME])

Usage

Examples

Notes

Requirements

Bugs and Limitations

Author

kon lovett

Version history

1.0.0
Initial release.

License

Copyright (C) 2009 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.