View Source edb_dap_request behaviour (edb v0.4.0)
Behaviour for handling client requests
Summary
Types
-type error_reaction() :: #{error := edb_dap_server:error(), actions => [edb_dap_server:action()], new_state => edb_dap_server:state()}.
-type reaction(T) :: #{response := response(T), actions => [edb_dap_server:action()], new_state => edb_dap_server:state()} | error_reaction().
-type resource() :: thread_id | variables_ref.
Callbacks
-callback handle(State, Arguments) -> reaction(edb_dap:body()) when State :: edb_dap_server:state(), Arguments :: edb_dap:arguments().
-callback parse_arguments(Arguments) -> {ok, ParsedArguments} | {error, Reason} when Arguments :: edb_dap:arguments(), ParsedArguments :: edb_dap:arguments(), Reason :: binary().
Functions
-spec abort(Error) -> no_return() when Error :: error_reaction().
-spec dispatch(Request, State) -> Reaction when Request :: edb_dap:request(), State :: edb_dap_server:state(), Reaction :: reaction(edb_dap:response()).
-spec not_paused(Pid) -> error_reaction() when Pid :: pid().
-spec parse_empty_arguments(Arguments) -> {ok, #{}} | {error, Reason} when Arguments :: edb_dap:arguments(), Reason :: binary().
-spec precondition_violation(Msg) -> error_reaction() when Msg :: iodata().
-spec success(Body) -> response(Body) when Body :: edb_dap:body().
-spec thread_id_to_pid(ThreadId) -> pid() when ThreadId :: edb_dap:thread_id().
-spec unexpected_request() -> error_reaction().
-spec unknown_resource(Type, Id) -> error_reaction() when Type :: resource(), Id :: number().
-spec unsupported(Msg) -> error_reaction() when Msg :: iodata().