Next: , Up: stdlib io   [Index]


5.8.1 Condition types

The procedures described in this chapter, when they detect an exceptional situation that arises from an “I/O errors”, raise an exception with condition type &i/o.

The condition types and corresponding predicates and accessors are exported by both the (rnrs io ports (6)) and (rnrs io simple (6)) libraries. They are also exported by the (rnrs files (6)) library.

Condition Type: &i/o
Procedure: make-i/o-error
Procedure: i/o-error? obj

This condition type could be defined by:

(define-condition-type &i/o &error
  make-i/o-error i/o-error?)

This is a supertype for a set of more specific I/O errors.

Condition Type: &i/o-read
Procedure: make-i/o-read-error
Procedure: i/o-read-error? obj

This condition type could be defined by:

(define-condition-type &i/o-read &i/o
  make-i/o-read-error i/o-read-error?)

This condition type describes read errors that occurred during an I/O operation.

Condition Type: &i/o-write
Procedure: make-i/o-write-error
Procedure: i/o-write-error? obj

This condition type could be defined by:

(define-condition-type &i/o-write &i/o
  make-i/o-write-error i/o-write-error?)

This condition type describes write errors that occurred during an I/O operation.

Condition Type: &i/o-invalid-position
Procedure: make-i/o-invalid-position-error position
Procedure: i/o-invalid-position-error? obj
Procedure: i/o-error-position condition

This condition type could be defined by:

(define-condition-type &i/o-invalid-position &i/o
  make-i/o-invalid-position-error
  i/o-invalid-position-error?
  (position i/o-error-position))

This condition type describes attempts to set the file position to an invalid position. position should be the file position that the program intended to set. This condition describes a range error, but not an assertion violation.

Condition Type: &i/o-filename
Procedure: make-i/o-filename-error filename
Procedure: i/o-filename-error? obj
Procedure: i/o-error-filename condition

This condition type could be defined by:

(define-condition-type &i/o-filename &i/o
  make-i/o-filename-error i/o-filename-error?
  (filename i/o-error-filename))

This condition type describes an I/O error that occurred during an operation on a named file. filename should be the name of the file, a Scheme string object.

Condition Type: &i/o-file-protection
Procedure: make-i/o-file-protection-error filename
Procedure: i/o-file-protection-error? obj

This condition type could be defined by:

(define-condition-type &i/o-file-protection
    &i/o-filename
  make-i/o-file-protection-error
  i/o-file-protection-error?)

A condition of this type specifies that an operation tried to operate on a named file with insufficient access rights.

Condition Type: &i/o-file-is-read-only
Procedure: make-i/o-file-is-read-only-error filename
Procedure: i/o-file-is-read-only-error? obj

This condition type could be defined by:

(define-condition-type &i/o-file-is-read-only
    &i/o-file-protection
  make-i/o-file-is-read-only-error
  i/o-file-is-read-only-error?)

A condition of this type specifies that an operation tried to operate on a named read–only file under the assumption that it is writeable.

Condition Type: &i/o-file-already-exists
Procedure: make-i/o-file-already-exists-error filename
Procedure: i/o-file-already-exists-error? obj

This condition type could be defined by:

(define-condition-type &i/o-file-already-exists
    &i/o-filename
  make-i/o-file-already-exists-error
  i/o-file-already-exists-error?)

A condition of this type specifies that an operation tried to operate on an existing named file under the assumption that it did not exist.

Condition Type: &i/o-file-does-not-exist
Procedure: make-i/o-file-does-not-exist-error filename
Procedure: i/o-file-does-not-exist-error? obj

This condition type could be defined by:

(define-condition-type &i/o-file-does-not-exist
    &i/o-filename
  make-i/o-file-does-not-exist-error
  i/o-file-does-not-exist-error?)

A condition of this type specifies that an operation tried to operate on an non–existent named file under the assumption that it existed.

Condition Type: &i/o-port
Procedure: make-i/o-port-error port
Procedure: i/o-port-error? obj
Procedure: i/o-error-port condition

This condition type could be defined by:

(define-condition-type &i/o-port &i/o
  make-i/o-port-error i/o-port-error?
  (port i/o-error-port))

This condition type specifies the port with which an I/O error is associated. port should be the port. Conditions raised by procedures accepting a port as an argument should include an &i/o-port-error condition.


Next: , Up: stdlib io   [Index]