From 449a1f1b5c99485f473704bc88f9f7ce8cf7a975 Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Fri, 18 Feb 2022 18:20:38 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20=E4=BB=A3=E7=A0=81=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/agVstCli.hrl | 2 +- src/agTest.erl | 3 +++ src/agVstCli/agVstCli.erl | 13 ++++++------- src/eArango.erl | 3 +++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/agVstCli.hrl b/include/agVstCli.hrl index 1caf331..3f64366 100644 --- a/include/agVstCli.hrl +++ b/include/agVstCli.hrl @@ -53,7 +53,7 @@ -ifdef(debug). -define(AgDebug(Tag, Format, Data), error_logger:info_msg("[~p] " ++ Format, [Tag | Data])). -else. --define(AgDebug(_Tag, _Format, _Data), ignore). +-define(AgDebug(_Tag, _Format, _Data), notDebug). -endif. -define(AgMDoDBConn, mDoDBConn). diff --git a/src/agTest.erl b/src/agTest.erl index b51c3dd..0779d0b 100644 --- a/src/agTest.erl +++ b/src/agTest.erl @@ -12,6 +12,9 @@ start() -> stop() -> eArango:closePool(tt). +isDebug() -> + ?AgDebug(test, "IMY**************", []). + tt(C, N) -> application:ensure_all_started(eArango), eArango:openPool(tt, [{poolSize, 1}], []), diff --git a/src/agVstCli/agVstCli.erl b/src/agVstCli/agVstCli.erl index a20ccfc..6d3ef49 100644 --- a/src/agVstCli/agVstCli.erl +++ b/src/agVstCli/agVstCli.erl @@ -24,24 +24,23 @@ , receiveSslData/2 ]). - --spec callAgency(poolNameOrSocket(), method(), path()) -> term() | {error, term()}. +-spec callAgency(poolNameOrSocket(), method(), path()) -> eArango:dbRet(). callAgency(PoolNameOrSocket, Method, Path) -> callAgency(PoolNameOrSocket, Method, Path, ?AgDefQuery, ?AgDefHeader, ?AgDefBody, false, ?AgDefTimeout). --spec callAgency(poolNameOrSocket(), method(), path(), queryPars()) -> term() | {error, term()}. +-spec callAgency(poolNameOrSocket(), method(), path(), queryPars()) -> eArango:dbRet(). callAgency(PoolNameOrSocket, Method, Path, QueryPars) -> callAgency(PoolNameOrSocket, Method, Path, QueryPars, ?AgDefHeader, ?AgDefBody, false, ?AgDefTimeout). --spec callAgency(poolNameOrSocket(), method(), path(), queryPars(), headers(), body()) -> term() | {error, term()}. +-spec callAgency(poolNameOrSocket(), method(), path(), queryPars(), headers(), body()) -> eArango:dbRet(). callAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body) -> callAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body, false, ?AgDefTimeout). --spec callAgency(poolNameOrSocket(), method(), path(), queryPars(), headers(), body(), boolean()) -> term() | {error, atom()}. +-spec callAgency(poolNameOrSocket(), method(), path(), queryPars(), headers(), body(), boolean()) -> eArango:dbRet(). callAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body, IsSystem) -> callAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body, IsSystem, ?AgDefTimeout). --spec callAgency(poolNameOrSocket(), method(), path(), queryPars(), headers(), body(), boolean(), timeout()) -> term() | {error, atom()}. +-spec callAgency(poolNameOrSocket(), method(), path(), queryPars(), headers(), body(), boolean(), timeout()) -> eArango:dbRet(). callAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body, IsSystem, Timeout) -> case castAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body, self(), IsSystem, Timeout) of {waitRRT, RequestId, MonitorRef} -> @@ -121,7 +120,7 @@ receiveReqRet(RequestId, MonitorRef) -> #agReqRet{messageId = RequestId, reply = Reply} -> erlang:demonitor(MonitorRef), case Reply of - {error, Err} -> + {error, _} = Err -> Err; _ -> {[_1, _2, StatusCode, HeaderMap], BodyMap} = eVPack:decodeAll(Reply), diff --git a/src/eArango.erl b/src/eArango.erl index dd566f9..8d37a70 100644 --- a/src/eArango.erl +++ b/src/eArango.erl @@ -21,6 +21,9 @@ ]). +-export_type([dbRet/0]). +-type(dbRet() :: {StatusCode :: non_neg_integer(), Body :: map(), Headers :: map()} | {error, term()}). + start() -> application:ensure_all_started(eArango).