浏览代码

give more explicit error when file larger than Sys.max_string_length

Nicolas Cannasse 12 年之前
父节点
当前提交
ab097ba03e
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      genswf.ml

+ 1 - 1
genswf.ml

@@ -834,7 +834,7 @@ let build_swf9 com file swc =
 		if String.length file > 5 && String.sub file 0 5 = "data:" then
 		if String.length file > 5 && String.sub file 0 5 = "data:" then
 			String.sub file 5 (String.length file - 5)
 			String.sub file 5 (String.length file - 5)
 		else
 		else
-			(try Std.input_file ~bin:true file with _  -> error "File not found" p)
+			(try Std.input_file ~bin:true file with Invalid_argument("String.create") -> error "File is too big (max 16MB allowed)" p | _  -> error "File not found" p)
 	in
 	in
 	let bmp = List.fold_left (fun acc t ->
 	let bmp = List.fold_left (fun acc t ->
 		match t with
 		match t with