|
22 | 22 | * along with this program; if not, write to the Free Software |
23 | 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) |
24 | 24 |
|
25 | | -type error = |
| 25 | + type untaggedVariant = | OnlyOneUnknown | AtMostOneObject | AtMostOneArray |
| 26 | + |
| 27 | + type error = |
26 | 28 | | Unsupported_predicates |
27 | 29 | | Conflict_bs_bs_this_bs_meth |
28 | 30 | | Duplicated_bs_deriving |
@@ -53,7 +55,7 @@ type error = |
53 | 55 | | Bs_uncurried_arity_too_large |
54 | 56 | | InvalidVariantAsAnnotation |
55 | 57 | | InvalidVariantTagAnnotation |
56 | | - | InvalidUntaggedVariantDefinition |
| 58 | + | InvalidUntaggedVariantDefinition of untaggedVariant |
57 | 59 |
|
58 | 60 | let pp_error fmt err = |
59 | 61 | Format.pp_print_string fmt |
@@ -104,8 +106,13 @@ let pp_error fmt err = |
104 | 106 | "A variant case annotation @as(...) must be a string or integer, boolean, null, undefined" |
105 | 107 | | InvalidVariantTagAnnotation -> |
106 | 108 | "A variant tag annotation @tag(...) must be a string" |
107 | | - | InvalidUntaggedVariantDefinition -> |
108 | | - "This untagged variant definition is invalid. But since I'm still work in progress I am not able to tell you why." |
| 109 | + | InvalidUntaggedVariantDefinition untaggedVariant -> |
| 110 | + "This untagged variant definition is invalid: " ^ |
| 111 | + (match untaggedVariant with |
| 112 | + | OnlyOneUnknown -> "An unknown case must be the only case with payloads." |
| 113 | + | AtMostOneObject -> "At most one case can be an object type." |
| 114 | + | AtMostOneArray -> "At most one case can be an array type." |
| 115 | + ) |
109 | 116 | ) |
110 | 117 |
|
111 | 118 | type exn += Error of Location.t * error |
|
0 commit comments