4141
4242-spec start_server (System :: atom (), ra_server :ra_server_config ()) ->
4343 supervisor :startchild_ret () |
44- {error , not_new | system_not_started | invalid_initial_machine_version } |
45- {badrpc , term ()}.
44+ {error , not_new | system_not_started | nodedown |
45+ invalid_initial_machine_version } | {badrpc , term ()}.
4646start_server (System , #{id := NodeId ,
4747 uid := UId } = Config )
4848 when is_atom (System ) ->
4949 Node = ra_lib :ra_server_id_node (NodeId ),
5050 rpc :call (Node , ? MODULE , start_server_rpc , [System , UId , Config ]).
5151
5252-spec restart_server (atom (), ra_server_id (), ra_server :mutable_config ()) ->
53- supervisor :startchild_ret () | {error , system_not_started } | {badrpc , term ()}.
53+ supervisor :startchild_ret () | {badrpc , term ()} |
54+ {error , system_not_started | nodedown }.
5455restart_server (System , {RaName , Node }, AddConfig ) ->
5556 rpc :call (Node , ? MODULE , restart_server_rpc ,
5657 [System , {RaName , Node }, AddConfig ]).
@@ -259,7 +260,7 @@ init([]) ->
259260
260261start_child (Name , Config ) ->
261262 Ref = make_ref (),
262- case supervisor :start_child (Name , [Config #{reply_to => {Ref , self ()}}]) of
263+ try supervisor :start_child (Name , [Config #{reply_to => {Ref , self ()}}]) of
263264 {ok , Pid } ->
264265 % % we have started the process now and have to wait for reply
265266 % % that is sent after init but before state machine recovery
@@ -275,4 +276,9 @@ start_child(Name, Config) ->
275276 end ;
276277 Err ->
277278 Err
279+ catch
280+ exit :{noproc , _ } ->
281+ {error , system_not_started };
282+ exit :{{nodedown , _ }, _ } ->
283+ {error , nodedown }
278284 end .
0 commit comments