Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing exception printing #5344

Closed
vicuna opened this issue Aug 19, 2011 · 0 comments
Closed

Confusing exception printing #5344

vicuna opened this issue Aug 19, 2011 · 0 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 19, 2011

Original bug ID: 5344
Reporter: @lpw25
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2012-09-25T18:06:17Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.1
Fixed in version: 3.12.1+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @lpw25

Bug description

Fatal exceptions are sometimes printed in an unexpected way.

For example compiling the following:

type test = A of int * string
| B of int * string

exception TestExc of test

let _ = raise (TestExc (A(3, "HelloWorld")))

and running it produces:

bash-3.2$ ocamlc testA.ml
bash-3.2$ ocamlrun a.out
Fatal error: exception TestA.TestExc(3, "HelloWorld")

Whereas this program:

type test = A of int * string
| B of int * string

exception TestExc of test

let _ = raise (TestExc(B(3, "HelloWorld")))

produces this:

bash-3.2$ ocamlc testB.ml
bash-3.2$ ocamlrun a.out
Fatal error: exception TestB.TestExc(_)

The second example is probably the correct behaviour. The problem seems to be caused by lines 60-66 in caml_format_exception in byterun/printexc.c, which are supposed to handle printing exceptions like Match_Failure and Assert_Failure.

@vicuna vicuna closed this as completed Sep 25, 2012
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant