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 section 3.12).

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 this 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_inline8872  exn :  not instantiated directly 
                fields:  message -- error message (type: string) 
                            debug-info -- value returned by the current debug info handler (called just after the exception and before raise) (type: anything) 
         tex2html_wrap_inline8872  user :  raised by calling error 
         tex2html_wrap_inline8872  syntax :  all syntax errors, but not read errors 
                      fields:  expr -- illegal expression (type: S-expression) 
         tex2html_wrap_inline8872  variable :  unbound identifier at run-time 
                      fields:  id -- the unbound identifier (type: identifier) 
         tex2html_wrap_inline8872  application :  not instantiated directly 
                      fields:  value -- the error-specific inappropriate value (type: error-specific) 
               tex2html_wrap_inline8872  non-procedure :  application of a non-procedure 
               tex2html_wrap_inline8872  arity :  application with the wrong number of arguments 
                            fields:  expected -- the correct procedure arity as returned by arity (type: arity) 
               tex2html_wrap_inline8872  type :  wrong argument type to a primitive, not including illegal zero or negative numbers to some math primitives 
                            fields:  expected -- name of the expected type (type: symbol) 
               tex2html_wrap_inline8872  range :  not instantiated directly 
                     tex2html_wrap_inline8872  bounds :  not instantiated directly 
                                  fields:  min -- minimum legal index (type: integer) 
                                              max -- maximum legal index (type: integer) 
                           tex2html_wrap_inline8872  vector :  illegal vector index; raised by  vector-ref,  vector-set! 
                           tex2html_wrap_inline8872  string :  illegal string index; raised by  string-ref,  string-set!,  substring 
                           tex2html_wrap_inline8872  struct :  illegal struct index; raised by struct-ref 
                     tex2html_wrap_inline8872  list :  illegal list index; raised by  list-ref,  list-tail 
               tex2html_wrap_inline8872  list-sizes :  mismatched list sizes; raised by map,  for-each 
               tex2html_wrap_inline8872  math :  not instantiated directly 
                     tex2html_wrap_inline8872  zero :  divide by zero, etc.; raised by  /,  quotient,  remainder,  modulo,  angle; application-value is always zero 
                     tex2html_wrap_inline8872  infinity :  infinity overflows; never raised by MzScheme 
                     tex2html_wrap_inline8872  negative :  illegal negative input (e.g. sqrt); never raised by MzScheme 
                     tex2html_wrap_inline8872  radix :  unsupported radix (positive fixnum); raised by  number->string 
               tex2html_wrap_inline8872  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_inline8872  fprintf :  not instantiated directly 
                     tex2html_wrap_inline8872  extra-arguments :  arguments without corresponding formatting tags; application-value is a list of extra arguments 
                     tex2html_wrap_inline8872  no-argument :  formatting tags without corresponding arguments; application-value is the tag string 
         tex2html_wrap_inline8872  else :  fall-through in  cond or  case (when MzScheme option is enabled) 
         tex2html_wrap_inline8872  struct :  not instantiated directly 
               tex2html_wrap_inline8872  super-type :  the supertype expression in define-struct returned something not a structure type value 
                            fields:  value -- the given supertype value (type: anything except structure type) 
         tex2html_wrap_inline8872  object :  not instantiated directly 
               tex2html_wrap_inline8872  super-type :  the superclass expression in class* returned a non-class 
                            fields:  value -- the given superclass value (type: anything except class) 
               tex2html_wrap_inline8872  class :  the object was not in the class; raised by  uq-ivar, generic procedure 
                            fields:  object -- the object (type: object) 
                                        class -- the class (type: class) 
               tex2html_wrap_inline8872  inherit :  inherited ivar not found; raised by  class* 
                            fields:  ivar -- instance variable name (type: identifier) 
               tex2html_wrap_inline8872  class-ivar :  instance variable not found; raised by  make-generic 
                            fields:  class -- the class (type: class) 
                                        ivar -- instance variable name (type: identifier) 
               tex2html_wrap_inline8872  ivar :  instance variable not found; raised by uq-ivar 
                            fields:  object -- the object (type: object) 
                                        class -- the class; #f indicates unspecified (type: class or #f) 
                                        ivar -- instance variable name (type: identifier) 
               tex2html_wrap_inline8872  private-class :  cannot instantiate or derive from this primitive class; raised by make-object, class* 
                            fields:  class -- the class (type: class) 
               tex2html_wrap_inline8872  init :  not instantiated directly 
                            fields:  object -- the object (type: object) 
                                        class -- the class in which the error occurred (type: class) 
                     tex2html_wrap_inline8872  multiple :  the superclass intialization proc (e.g.,  super-init) called twice for the class 
                     tex2html_wrap_inline8872  never :  the superclass intialization proc (e.g.,  super-init) never called for the class 
         tex2html_wrap_inline8872  unit :  not instantiated directly 
               tex2html_wrap_inline8872  non-unit :  attempt to link a non-unit; raised by compound-unit 
                            fields:  value -- non-unit value (type: anything) 
               tex2html_wrap_inline8872  arity :  attempt to link a unit with the wrong number of imported variables; raised by compound-unit 
                            fields:  unit -- unit (type: unit) 
               tex2html_wrap_inline8872  import :  cannot find variable to import; raised by compound-unit 
                            fields:  unit -- importing unit (type: unit) 
                                        tag -- import variable tag (type: identifier) 
                                        name -- inport variable name (type: identifier) 
               tex2html_wrap_inline8872  export :  cannot find variable to export for compound unit; raised by compound-unit 
                            fields:  tag -- import variable tag (type: identifier) 
                                        name -- inport variable name (type: identifier) 
         tex2html_wrap_inline8872  read :  not instantiated directly 
                      fields:  port -- port being read (type: port) 
               tex2html_wrap_inline8872  paren :  unexpected close paren 
               tex2html_wrap_inline8872  number :  bad number syntax 
                            fields:  input -- input number string (type: string) 
               tex2html_wrap_inline8872  char :  bad character constant 
                            fields:  input -- input character string without # tex2html_wrap_inline6608   (type: string) 
               tex2html_wrap_inline8872  eof :  unexpected end of file 
                            fields:  expected -- expected input (type: string) 
               tex2html_wrap_inline8872  dot :  dot at top-level or illegal use of dot; e.g., ( . 1) 
               tex2html_wrap_inline8872  unsupported :  unsupported # tag 
                            fields:  input -- input string without # (type: string) 
               tex2html_wrap_inline8872  vector-length :  illegal vector size in vector constant 
                            fields:  input -- vector length string (type: string) 
               tex2html_wrap_inline8872  compiled :  illegal MzScheme compiled code 
               tex2html_wrap_inline8872  graph :  bad graph syntax 
         tex2html_wrap_inline8872  i/o :  not instantiated directly 
               tex2html_wrap_inline8872  filesystem :  not instantiated directly 
                            fields:  pathname -- pathname (type: string) 
                     tex2html_wrap_inline8872  filename :  bad filename or file not found; raised by all file procedures that take a pathname 
                     tex2html_wrap_inline8872  directory :  directory not found; raised by  current-directory,  directory-list,  load-with-cd 
                     tex2html_wrap_inline8872  username :  bad username (Unix only); raised by all file procedures that take a pathname 
                     tex2html_wrap_inline8872  file-exists :  cannot overwrite file; raised by open-output-file 
               tex2html_wrap_inline8872  port-closed :  attempt to operate on a closed port; raised by  read,  write,  display,  char-ready? 
                            fields:  port -- port for attempted operation (type: port) 
               tex2html_wrap_inline8872  user-port :  user-defined input port returned a non-character from the character-getting procedure 
                            fields:  port -- user-defined input port (type: port) 
         tex2html_wrap_inline8872  misc :  low-level errors 
               tex2html_wrap_inline8872  unsupported :  unsupported feature 
               tex2html_wrap_inline8872  user-break :  user break poll handler returned a true value 
               tex2html_wrap_inline8872  out-of-memory :  out of memory 
               tex2html_wrap_inline8872  defmacro :  macro handler is not a procedure 
                            fields:  value -- the given macro handler (type: anything except a procedure) 
               tex2html_wrap_inline8872  expansion-time :  local-expansion-time-value called at run-time 
               tex2html_wrap_inline8872  constant :  attempt to change a constant global; raised by  set!,  define,  undefine 
                            fields:  id -- constant identifier (type: identifier) 
               tex2html_wrap_inline8872  continuation :  attempt to cross a continuation boundary or apply another thread's continuation 
               tex2html_wrap_inline8872  hash-table :  failed hash table lookup 
                            fields:  key -- key for failed lookup (type: anything) 
               tex2html_wrap_inline8872  regexp :  all regular expression errors 
               tex2html_wrap_inline8872  process :  error executing an operating system process 
               tex2html_wrap_inline8872  dynamic-extension :  not instantiated directly 
                            fields:  name -- dynamic extension pathname (type: string) 
                     tex2html_wrap_inline8872  open :  cannot open dynamic extension 
                     tex2html_wrap_inline8872  version :  dynamic extension is wrong version 
                     tex2html_wrap_inline8872  initialize :  cannot initialize dynamic extension

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


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

PLT