From 8e20da23d551d781dd91b6e5cdd1aa15379286a1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 10 Jul 2018 15:27:43 +0200 Subject: [PATCH] Better error message in OCaml --- src/ezfio.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ezfio.ml b/src/ezfio.ml index 2c6ea0a..23a8337 100644 --- a/src/ezfio.ml +++ b/src/ezfio.ml @@ -378,7 +378,9 @@ let read_array type_conversion group name : 'a ezfio_array = (* Read one-dimensional arrays *) let read_1d nmax = Ezfio_item (Array.init nmax (fun i-> - type_conversion (trim (input_line in_channel))) ) + let buffer = trim (input_line in_channel) in + try type_conversion buffer with + | Failure s -> failwith (s^": "^buffer)) in (* Read multi-dimensional arrays *) let rec read_nd = function