View Source edb_dap_request behaviour (edb v0.4.0)

Behaviour for handling client requests

Summary

Types

error_reaction()

-type error_reaction() ::
          #{error := edb_dap_server:error(),
            actions => [edb_dap_server:action()],
            new_state => edb_dap_server:state()}.

reaction()

-type reaction() :: reaction(none()).

reaction(T)

-type reaction(T) ::
          #{response := response(T),
            actions => [edb_dap_server:action()],
            new_state => edb_dap_server:state()} |
          error_reaction().

resource()

-type resource() :: thread_id | variables_ref.

response(T)

-type response(T) :: #{success := boolean(), message => binary(), body => T}.

Callbacks

handle(State, Arguments)

-callback handle(State, Arguments) -> reaction(edb_dap:body())
                    when State :: edb_dap_server:state(), Arguments :: edb_dap:arguments().

parse_arguments(Arguments)

-callback parse_arguments(Arguments) -> {ok, ParsedArguments} | {error, Reason}
                             when
                                 Arguments :: edb_dap:arguments(),
                                 ParsedArguments :: edb_dap:arguments(),
                                 Reason :: binary().

Functions

abort(Error)

-spec abort(Error) -> no_return() when Error :: error_reaction().

dispatch(Request, State)

-spec dispatch(Request, State) -> Reaction
                  when
                      Request :: edb_dap:request(),
                      State :: edb_dap_server:state(),
                      Reaction :: reaction(edb_dap:response()).

not_paused(Pid)

-spec not_paused(Pid) -> error_reaction() when Pid :: pid().

parse_empty_arguments(Arguments)

-spec parse_empty_arguments(Arguments) -> {ok, #{}} | {error, Reason}
                               when Arguments :: edb_dap:arguments(), Reason :: binary().

precondition_violation(Msg)

-spec precondition_violation(Msg) -> error_reaction() when Msg :: iodata().

success()

-spec success() -> response(none()).

success(Body)

-spec success(Body) -> response(Body) when Body :: edb_dap:body().

thread_id_to_pid(ThreadId)

-spec thread_id_to_pid(ThreadId) -> pid() when ThreadId :: edb_dap:thread_id().

unexpected_request()

-spec unexpected_request() -> error_reaction().

unknown_resource(Type, Id)

-spec unknown_resource(Type, Id) -> error_reaction() when Type :: resource(), Id :: number().

unsupported(Msg)

-spec unsupported(Msg) -> error_reaction() when Msg :: iodata().