Unified · Split
| @@ -712,14 +712,15 @@ let keys_of_string s = · 711 unmodified lines | ||
| 712 | 712 | |
| 713 | 713 | let validatehcs v = |
| 714 | 714 | let l = String.length v in |
| 715 | − if l < 2 then failwith "set is too small, must be greater than one char"; | |
| 715 | + if l < 2 | |
| 716 | + then error "set must contain more than one char, but has %d" l; | |
| 716 | 717 | let module S = Set.Make (struct type t = char let compare = compare end) in |
| 717 | 718 | let rec check s i = |
| 718 | 719 | if i < l |
| 719 | 720 | then |
| 720 | 721 | let e = String.get v i in |
| 721 | 722 | if S.mem e s |
| 722 | − then failwith "has duplicates" | |
| 723 | + then error "set has duplicates (at least '%c')" e | |
| 723 | 724 | else check (S.add e s) (i+1) |
| 724 | 725 | in |
| 725 | 726 | check (S.singleton (String.get v 0)) 1 |