[previous] [up] [next]     [contents] [index]
Next: Errors Up: Exceptions Previous: Exceptions

Primitive Exceptions

Whenever a primitive error occurs in MzScheme, an exception is raised. The value that is passed to the current exception handler is always an instance of the exn structure type. Every exn structure value has a message field that is a string, the primitive error message. The default exception handler recognizes exception values with the exn? predicate and passes the error message to the current error display handler (see error-display-handler in section 9.4.1.9).

Primitive errors do not create immediate instances of the exn structure type. Instead, an instance from a hierarchy of subtypes of exn is instantiated. The subtype more precisely identifies the error that occurred and may contain additional information about the error. The table below defines the type hierarchy that is used by primitive errors and matches each subtype with the primitive errors that instantiate it.

In the table, each bulleted line is a separate structure type. A type is nested under another when it is a subtype. The full name of the structure type (as used by predicates and selectors in the global environment) is built by combining the full name of the immediate supertype with ``:'' and the subtype name.

For example, applying a procedure to the wrong number of arguments raises an exception as an instance of exn:application:arity. An exception handler can test for this kind of excpetion using the global exn:application:arity? predicate. Given such an exception, the (incorrect) number of arguments provided is obtained from the exception with exn:application-value, while exn:application:arity-expected accesses the actual arity of the procedure.

 tex2html_wrap_inline12792  exn : not instantiated directly 
            fields: message -- error message (type: string) 
                    debug-info -- value returned by the current debug info handler (called immediately after the error is detected) (type: anything) 
       tex2html_wrap_inline12792  user : raised by calling error 
       tex2html_wrap_inline12792  syntax : all syntax errors, but not read errors 
                  fields: expr -- illegal expression (or #f if unknown) (type: S-expression) 
       tex2html_wrap_inline12792  variable : unbound global variable at run-time 
                  fields: id -- the unbound variable's global identifier (type: identifier) 
       tex2html_wrap_inline12792  application : not instantiated directly 
                  fields: value -- the error-specific inappropriate value (type: error-specific) 
             tex2html_wrap_inline12792  non-procedure : application of a non-procedure 
             tex2html_wrap_inline12792  arity : application with the wrong number of arguments 
                        fields: expected -- the correct procedure arity as returned by arity (type: arity) 
             tex2html_wrap_inline12792  type : wrong argument type to a procedure, not including divide-by-zero or platform-specific integer range errors 
                        fields: expected -- name of the expected type (type: symbol) 
             tex2html_wrap_inline12792  range : not instantiated directly 
                   tex2html_wrap_inline12792  bounds : not instantiated directly 
                              fields: min -- minimum legal index (type: integer) 
                                      max -- maximum legal index (type: integer) 
                         tex2html_wrap_inline12792  vector : illegal vector index; raised by vector-ref, vector-set! 
                         tex2html_wrap_inline12792  string : illegal string index; raised by string-ref, string-set!, substring 
                         tex2html_wrap_inline12792  struct : illegal struct index; raised by struct-ref 
                   tex2html_wrap_inline12792  list : illegal list index; raised by list-ref, list-tail 
             tex2html_wrap_inline12792  list-sizes : mismatched list sizes; raised by map, for-each, make-struct-case 
             tex2html_wrap_inline12792  map-arity : arity of supplied procedure does not match the number of lists provided to map, for-each, andmap, ormap 
                        fields: provided -- the number of lists provided for mapping (type: non-negative integer) 
             tex2html_wrap_inline12792  integer : integer out of machine-specific range; raised by make-semaphore, set-thread-weight!, seconds->date 
             tex2html_wrap_inline12792  list : encountered a non-pair in a value expected to be a proper list, or a non-pair item in a value expected to be an association list; raised by member, memv, memq, assoc, assv, assq[footnote] 
             tex2html_wrap_inline12792  math : not instantiated directly 
                   tex2html_wrap_inline12792  zero : divide by zero, etc.; raised by /, quotient, remainder, modulo, angle; application-value is always zero 
                   tex2html_wrap_inline12792  infinity : infinity overflows; never raised by MzScheme 
                   tex2html_wrap_inline12792  negative : illegal negative input (e.g. sqrt); never raised by MzScheme 
                   tex2html_wrap_inline12792  radix : unsupported radix (positive fixnum); raised by number->string 
             tex2html_wrap_inline12792  mode-conflict : incompatible mode flags; raised by open-output-file, call-with-output-file, with-output-to-file 
                        fields: filename -- filename being opened (type: string) 
             tex2html_wrap_inline12792  file-position : position was provided, but the port was not a file port; raised by file-position; application-value is the port 
             tex2html_wrap_inline12792  fprintf : not instantiated directly 
                   tex2html_wrap_inline12792  extra-arguments : arguments without corresponding formatting tags; application-value is the format string 
                              fields: extras -- arguments without formatting tags (type: list of values) 
                   tex2html_wrap_inline12792  no-argument : formatting tags without corresponding arguments; application-value is the format string 
                   tex2html_wrap_inline12792  argument-type : argument does not match type expected by formatting tag; application-value is the bad value 
                              fields: expected -- type expected by formatting tag (type: symbol) 
             tex2html_wrap_inline12792  macos-typestring : string is not a four-character string, so it does not specify a MacOS application signature or file type; raised by system, execute, send-event 
       tex2html_wrap_inline12792  else : fall-through in cond or case 
       tex2html_wrap_inline12792  struct : not instantiated directly 
             tex2html_wrap_inline12792  struct-type : the supertype expression in a struct form returned a value that was not a structure type value 
                        fields: value -- the given supertype value (type: anything except structure type) 
       tex2html_wrap_inline12792  object : not instantiated directly 
             tex2html_wrap_inline12792  class-type : the superclass expression in class* returned a non-class 
                        fields: value -- the value provided as a superclass (type: anything except class) 
             tex2html_wrap_inline12792  interface-type : an interface expression in class* or scmfirstinterface returned a non-interface 
                        fields: value -- the value provided as an interface (type: anything except interface) 
             tex2html_wrap_inline12792  generic : the object was not an instance of the generic's class or interface; raised by generic procedures 
                        fields: object -- the object (type: object) 
             tex2html_wrap_inline12792  inherit : inherited ivar not found; raised by class* 
                        fields: ivar -- instance variable name (type: identifier) 
             tex2html_wrap_inline12792  implement : ivar required by an interface not found in the implementation; raised by class* 
                        fields: ivar -- instance variable name (type: identifier) 
             tex2html_wrap_inline12792  class-ivar : instance variable not found in class; raised by uq-make-generic 
                        fields: class -- the class (type: class) 
                                ivar -- instance variable name (type: identifier) 
             tex2html_wrap_inline12792  interface-ivar : instance variable not found in interface; raised by uq-make-generic 
                        fields: interface -- the interface (type: interface) 
                                ivar -- instance variable name (type: identifier) 
             tex2html_wrap_inline12792  ivar : instance variable not found; raised by uq-ivar 
                        fields: object -- the object (type: object) 
                                ivar -- instance variable name (type: identifier) 
             tex2html_wrap_inline12792  private-class : cannot instantiate or derive from this primitive class; raised by make-object, class* 
                        fields: class -- the class (type: class) 
             tex2html_wrap_inline12792  init : not instantiated directly 
                        fields: object -- the object (type: object) 
                                class -- the class that called a superclass initializer too much or not enough (type: class) 
                   tex2html_wrap_inline12792  multiple : the superclass intialization proc (e.g., super-init) called twice for the class 
                   tex2html_wrap_inline12792  never : the superclass intialization proc (e.g., super-init) never called for the class 
       tex2html_wrap_inline12792  unit : not instantiated directly 
             tex2html_wrap_inline12792  non-unit : attempt to link a non-unit; raised by compound-unit, invoke-unit, invoke-open-unit 
                        fields: value -- non-unit value (type: anything) 
             tex2html_wrap_inline12792  arity : attempt to link a unit with the wrong number of imported variables; raised by compound-unit 
                        fields: unit -- badly linked unit (type: unit) 
             tex2html_wrap_inline12792  import : cannot find variable to import; raised by compound-unit 
                        fields: in-unit -- importing unit (type: unit) 
                                out-unit -- source unit (type: unit) 
                                in-tag -- importing unit tag (type: identifier) 
                                out-tag -- source unit tag (type: identifier) 
                                name -- import variable name (type: identifier) 
             tex2html_wrap_inline12792  export : cannot find variable to export for compound unit; raised by compound-unit 
                        fields: unit -- source unit (type: unit) 
                                tag -- source unit tag (type: identifier) 
                                name -- source variable name (type: identifier) 
             tex2html_wrap_inline12792  invoke : not instantiated directly 
                   tex2html_wrap_inline12792  variable : cannot invoke with import of an undefined global variable 
                              fields: name -- bad identifier (type: identifier) 
             tex2html_wrap_inline12792  signature : not instantiated directly 
                   tex2html_wrap_inline12792  non-signed-unit : attempt to link a non-signed-unit; raised by compound-unit/sig, invoke-unit/sig, invoke-open-unit/sig 
                              fields: value -- non-signed-unit value (type: anything) 
                   tex2html_wrap_inline12792  arity : attempt to link signed unit with the wrong number of imported units; raised by compound-unit/sig 
                              fields: unit -- signed-unit (type: signed-unit) 
                   tex2html_wrap_inline12792  match : not instantiated directly 
                              fields: dest-context -- destination context (type: string) 
                                      src-context -- source context (type: string) 
                                      variable -- mismatch variable name (type: string) 
                         tex2html_wrap_inline12792  missing : signature mismatch (missing variable) detected by verify-signature-match 
                         tex2html_wrap_inline12792  extra : signature mismatch (extra variable) detected by verify-signature-match 
                         tex2html_wrap_inline12792  kind : signature mismatch (mismatched kinds) detected by verify-signature-match 
       tex2html_wrap_inline12792  read : not instantiated directly 
                  fields: port -- port being read (type: port) 
             tex2html_wrap_inline12792  paren : unexpected close paren 
             tex2html_wrap_inline12792  number : bad number syntax 
                        fields: input -- input number string (type: string) 
             tex2html_wrap_inline12792  char : bad character constant 
                        fields: input -- input character string without #\ (type: string) 
             tex2html_wrap_inline12792  eof : unexpected end of file 
                        fields: expected -- expected input (type: string) 
             tex2html_wrap_inline12792  dot : dot at top-level or illegal use of dot; e.g., ( . 1) 
             tex2html_wrap_inline12792  unsupported : unsupported # tag 
                        fields: input -- input string without # (type: string) 
             tex2html_wrap_inline12792  vector-length : bad vector size in vector constant 
                        fields: input -- vector length string (type: string) 
             tex2html_wrap_inline12792  compiled : illegal MzScheme compiled code 
             tex2html_wrap_inline12792  graph : bad graph syntax 
       tex2html_wrap_inline12792  i/o : not instantiated directly 
             tex2html_wrap_inline12792  read : error reading from a port 
                        fields: port -- port with read error (type: input port) 
             tex2html_wrap_inline12792  write : error writing to a port 
                        fields: port -- port with write error (type: output port) 
             tex2html_wrap_inline12792  filesystem : not instantiated directly 
                        fields: pathname -- pathname (type: string) 
                   tex2html_wrap_inline12792  path : bad pathname; raised by all file procedures that take a pathname 
                         tex2html_wrap_inline12792  username : bad username (Unix only); raised by all file procedures that take a pathname 
                   tex2html_wrap_inline12792  file : file not found or file operation failed; raised by procedures that operate on files, plus file-or-directory-modify-seconds, file-or-directory-permissions 
                   tex2html_wrap_inline12792  directory : directory not found or directory operation failed; raised by procedures that operate on directories 
                   tex2html_wrap_inline12792  rename : rename or copy failed; copy-file, rename-file-or-directory 
                              fields: destination -- pathname (type: string) 
                   tex2html_wrap_inline12792  collection : collection not found; raised by require-library, require-relative-library 
                   tex2html_wrap_inline12792  file-exists : cannot overwrite file; raised by open-output-file 
                   tex2html_wrap_inline12792  link : bad link discovered; raised by simplify-path 
             tex2html_wrap_inline12792  port-closed : attempt to operate on a closed port; raised by read, write, display, print, char-ready? 
                        fields: port -- port for attempted operation (type: port) 
             tex2html_wrap_inline12792  user-port : user-defined input port returned a non-character from the character-getting procedure 
                        fields: port -- user-defined input port (type: input port) 
             tex2html_wrap_inline12792  tcp : TCP errors 
                   tex2html_wrap_inline12792  connect : tcp-connect low-level failure 
                              fields: address -- address to connect to (type: string) 
                                      port-id -- port to connect to (type: integer) 
                   tex2html_wrap_inline12792  listen : tcp-listen low-level failure 
                              fields: port-id -- port to listen on (type: integer) 
                   tex2html_wrap_inline12792  accept : tcp-accept low-level failure 
                              fields: listener -- listener to accept from (type: listener) 
                   tex2html_wrap_inline12792  listener-closed : listener closed for tcp-accept, tcp-accept-ready?, tcp-stop 
                              fields: listener -- listener that has been closed (type: listener) 
       tex2html_wrap_inline12792  misc : low-level errors 
             tex2html_wrap_inline12792  unsupported : unsupported feature 
             tex2html_wrap_inline12792  user-break : asynchronous thread break 
             tex2html_wrap_inline12792  out-of-memory : out of memory 
             tex2html_wrap_inline12792  parameterization : the parameterization branch handler or sharing procedure returned a non-parameterization; raised by thread, make-parameterization-with-sharing 
                        fields: value -- bad value (type: anything except a parameterization) 
             tex2html_wrap_inline12792  defmacro : macro handler is not a procedure 
                        fields: value -- the given macro handler (type: anything except a procedure) 
             tex2html_wrap_inline12792  expansion-time : local-expansion-time-value, global-expansion-time-value, local-expand-defmacro, or local-expand-body-expression called at run-time 
             tex2html_wrap_inline12792  constant : attempt to change a constant global; raised by set!, define, undefine, invoke-open-unit 
                        fields: id -- constant identifier (type: identifier) 
             tex2html_wrap_inline12792  continuation : attempt to cross a continuation boundary or apply another thread's continuation 
             tex2html_wrap_inline12792  thread : not instantiated directly 
                   tex2html_wrap_inline12792  kill : cannot kill the thread; raised by kill-thread 
             tex2html_wrap_inline12792  semaphore : a semaphore's maximum internal count has been exceeded 
             tex2html_wrap_inline12792  hash-table : failed hash table lookup 
                        fields: key -- key for failed lookup (type: anything) 
             tex2html_wrap_inline12792  regexp : all regular expression errors 
             tex2html_wrap_inline12792  process : error executing an operating system process 
             tex2html_wrap_inline12792  send-event : error sending an event to another system process 
             tex2html_wrap_inline12792  dynamic-extension : not instantiated directly 
                        fields: name -- dynamic extension pathname (type: string) 
                   tex2html_wrap_inline12792  open : cannot open dynamic extension 
                   tex2html_wrap_inline12792  version : dynamic extension is wrong version 
                   tex2html_wrap_inline12792  initialize : cannot initialize dynamic extension 
             tex2html_wrap_inline12792  image : error dumping or restoring an image; raised by write-image-to-file, read-image-from-file 
                        fields: name -- image pathname (type: string)

Primitive procedures that accept a procedure argument with a particular required arity (e.g., call-with-input-file, call/cc) check the argument's arity immediately, raising exn:application:type if the arity is incorrect.

The secure-primitive-exception-types procedure takes no arguments and undefines all of the primitive exception structure type values and constructors, so that all new primitives exception values can only be generated by the system. The structure predicates and selectors are not affected.


[previous] [up] [next]     [contents] [index]
Next: Errors Up: Exceptions Previous: Exceptions

PLT