Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000123OCamlOCaml generalpublic2000-05-22 13:032011-05-29 12:20
Reporteradministrator 
Assigned Toxclerc 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.11.2+dev 
Summary0000123: Pretty printer pour exceptions
DescriptionFull_Name: fabrice le fessant
Version: 3.00
OS: linux...
Submission from: cremant.inria.fr (128.93.8.143)


printexc.mli:

val install_printer : (exn -> string option) -> unit
        (* Install a pretty printer for some exceptions. The printer returns
           [None] if it can not pretty-print the exception, or [Some s]
           with the string corresponding to the exception. *)
  


printexc.ml:

let printers = ref []
let install_printer p = printers := p :: !printers

let to_string = function
   ....
  | x ->
      let rec iter list =
        match list with
          [] -> raise Not_found
        | p :: tail ->
            try
              match p x with
                None -> raise Not_found
              | Some s -> s
            with _ -> iter tail
      in
      try
        iter !printers
      with _ ->
      let x = Obj.repr x in
      let constructor = (Obj.magic(Obj.field (Obj.field x 0) 0) : string) in
      constructor ^ (fields x)

TagsNo tags attached.
Attached Files

- Relationships
has duplicate 0004477closedxclerc Feature wish: custom exception printers 

-  Notes
(0005102)
xclerc (developer)
2009-09-16 15:35

support for custom exception printers has been committed in the 'release311' branch.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2009-08-20 13:20 xclerc Relationship added has duplicate 0004477
2009-09-16 15:35 xclerc Note Added: 0005102
2009-09-16 15:35 xclerc Status acknowledged => resolved
2009-09-16 15:35 xclerc Fixed in Version => 3.11.2+dev
2009-09-16 15:35 xclerc Resolution open => fixed
2009-09-16 15:35 xclerc Assigned To => xclerc
2011-05-29 12:20 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker