@@ -68,9 +68,12 @@ format(_Cmd, {error, {too_many_equal_signs, Arg}}) ->
68
68
format (_Cmd , {error , {invalid_config_keys , Invalid }}) ->
69
69
status (io_lib :format (" Invalid config keys: ~ts " , [Invalid ]));
70
70
format (_Cmd , {error , {invalid_config , {error , [_H |_T ]= Msgs }}}) ->
71
- % % Cuttlefish deeply nested errors
71
+ % % Cuttlefish deeply nested errors (original cuttlefish)
72
72
status (string :join (lists :map (fun ({error , Msg }) -> Msg end ,
73
73
Msgs ), " \n " ));
74
+ format (_Cmd , {error , {invalid_config , {errorlist , Errors }}}) ->
75
+ % % Cuttlefish deeply nested errors (new cuttlefish error scheme)
76
+ status (string :join (lists :map (fun error_map /1 , Errors ), " \n " ));
74
77
format (_Cmd , {error , {invalid_config , Msg }}) ->
75
78
status (io_lib :format (" Invalid configuration: ~p~n " , [Msg ]));
76
79
format (_Cmd , {error , {rpc_process_down , Node }}) ->
@@ -85,3 +88,11 @@ format(_Cmd, {error, bad_node}) ->
85
88
-spec status (string ()) -> status ().
86
89
status (Str ) ->
87
90
[clique_status :alert ([clique_status :text (Str )])].
91
+
92
+ % % Here we can override cuttlefish error messages to make them more
93
+ % % useful in an interactive context
94
+ -spec error_map (cuttlefish_error :error ()) -> iolist ().
95
+ error_map ({error , {unknown_variable , Variable }}) ->
96
+ io_lib :format (" Unknown variable: ~ts " , [Variable ]);
97
+ error_map ({error , ErrorTerm }) ->
98
+ cuttlefish_error :xlate (ErrorTerm ).
0 commit comments