Original bug ID: 6557 Reporter: oliver Status: closed (set by @xavierleroy on 2016-12-07T10:36:47Z) Resolution: fixed Priority: normal Severity: minor Platform: PC / Linux OS: Arch Linux Version: 4.02.0+beta1 / +rc1 Target version: 4.02.1+dev Fixed in version: 4.02.1+dev Category: standard library Related to:#6560 Monitored by:@gasche@hcarty
Bug description
String.sub throws Invalid_argument("Bytes.sub") when non-valid susbstring found.
Steps to reproduce
In Toplevel:
String.sub;;
: string -> int -> int -> string =
String.sub "" 0 1 ;;
Exception: Invalid_argument "Bytes.sub".
The text was updated successfully, but these errors were encountered:
A) do nothing
B) try..with (probably too slow)
C) use "String.sub" in the exception for both Bytes.sub and String.sub
The point that the string content of the exception is unspecified is fair, and (A) is therefore a valid choice. But it breaks user code; I'd rather be tempted to try (C). Any opinions?
Fixed in branch 4.02 (commit 15520) with solution D. People who match on the string will have a bad surprise but we'll explain that they shouldn't do that.
Original bug ID: 6557
Reporter: oliver
Status: closed (set by @xavierleroy on 2016-12-07T10:36:47Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: PC / Linux
OS: Arch Linux
Version: 4.02.0+beta1 / +rc1
Target version: 4.02.1+dev
Fixed in version: 4.02.1+dev
Category: standard library
Related to: #6560
Monitored by: @gasche @hcarty
Bug description
String.sub throws Invalid_argument("Bytes.sub") when non-valid susbstring found.
Steps to reproduce
In Toplevel:
String.sub;;
String.sub "" 0 1 ;;
Exception: Invalid_argument "Bytes.sub".
The text was updated successfully, but these errors were encountered: