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

Wrong failure message for {Int32,Int64,NativeInt}.of_string #6560

Closed
vicuna opened this issue Sep 15, 2014 · 2 comments
Closed

Wrong failure message for {Int32,Int64,NativeInt}.of_string #6560

vicuna opened this issue Sep 15, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Sep 15, 2014

Original bug ID: 6560
Reporter: @damiendoligez
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2016-12-07T10:37:13Z)
Resolution: fixed
Priority: low
Severity: tweak
Version: 4.02.1+dev
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.03.0+dev / +beta1
Category: standard library
Tags: junior_job
Related to: #6557
Monitored by: @hcarty

Bug description

Int64.of_string, when given an invalid argument, raises Failure "int_of_string". That should be "Int64.of_string". Same problem with Int32 and NativeInt.

Steps to reproduce

OCaml version 4.02.1+dev0-2014-08-29

Int64.of_string "x";;

Exception: Failure "int_of_string".

File attachments

@vicuna
Copy link
Author

vicuna commented Oct 30, 2014

Comment author: mdenes

The attached patch solves this issue in the same way as #6557, listing in the string all stdlib functions from which the exception can be triggered.

@vicuna
Copy link
Author

vicuna commented Dec 14, 2014

Comment author: @gasche

I initially planned to merge this patch, but on thinking about it more I found it unsatisfying: most users only use int_of_string, and for them the new error message is arguably a regression. I thus added an extra const char *errmsg parameter to the parsing function, so that each function gets its own error message.

Applied in trunk, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants