Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* Copyright (C) 2017 Matthew Fluet. |
2 | * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh | |
3 | * Jagannathan, and Stephen Weeks. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | *) | |
8 | ||
9 | structure Error: ERROR = | |
10 | struct | |
11 | ||
12 | fun bug msg = raise (Fail msg) | |
13 | ||
14 | fun reraise (exn, {prefix, suffix}) = | |
15 | bug (concat [prefix, | |
16 | case exn of | |
17 | Fail msg => msg | |
18 | | _ => General.exnName exn, | |
19 | suffix]) | |
20 | ||
21 | fun reraisePrefix (exn, msg) = reraise (exn, {prefix = msg, suffix = ""}) | |
22 | fun reraiseSuffix (exn, msg) = reraise (exn, {prefix = "", suffix = msg}) | |
23 | ||
24 | fun unimplemented msg = raise Fail (concat ["unimplemented: ", msg]) | |
25 | ||
26 | fun warning msg = TextIO.output (TextIO.stdErr, concat [msg, "\n"]) | |
27 | ||
28 | end |