summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1998-06-01 11:42:57 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1998-06-01 11:42:57 +0000
commit55ef09aba4ea9c7f7e444aa0dcbc8c4b807c591a (patch)
treee0a502b3936f533dd30308a0e6bc55e312245201
parent80bb5c6c8bb3f006547b75a075e88a6e6122d679 (diff)
Meilleur message d'erreur si opendbm echoue
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1973 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--otherlibs/dbm/dbm.ml11
1 files changed, 9 insertions, 2 deletions
diff --git a/otherlibs/dbm/dbm.ml b/otherlibs/dbm/dbm.ml
index 588562c48..e8372a916 100644
--- a/otherlibs/dbm/dbm.ml
+++ b/otherlibs/dbm/dbm.ml
@@ -22,9 +22,16 @@ type dbm_flag =
exception Dbm_error of string
-external opendbm : string -> open_flag list -> int -> t
+external raw_opendbm : string -> open_flag list -> int -> t
= "caml_dbm_open"
- (* this one is exported as val, so that we are sure to link in this
+
+let opendbm file flags mode =
+ try
+ raw_opendbm file flags mode
+ with Dbm_error msg ->
+ raise(Dbm_error("Can't open file " ^ file))
+
+ (* By exporting opendbm as val, we are sure to link in this
file (we must register the exception). Since t is abstract, programs
have to call it in order to do anything *)