Produce a better error message if qdate hasn't been started
This commit is contained in:
parent
817c14c46e
commit
794d03a5ee
4 changed files with 37 additions and 21 deletions
30
Makefile
30
Makefile
|
@ -1,18 +1,18 @@
|
||||||
REBAR_PATH = $(shell which rebar3)
|
|
||||||
|
|
||||||
ifeq ($(REBAR_PATH),)
|
|
||||||
REBAR = $(shell pwd)/rebar3
|
|
||||||
else
|
|
||||||
REBAR = rebar3
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
all: compile
|
all: compile
|
||||||
|
|
||||||
compile:
|
# Check if rebar3.mk exists, and if not, download it
|
||||||
|
ifeq ("$(wildcard rebar3.mk)","")
|
||||||
|
$(shell curl -O https://raw.githubusercontent.com/choptastic/rebar3.mk/master/rebar3.mk)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# rebar3.mk adds a new rebar3 rule to your Makefile
|
||||||
|
# (see https://github.com/choptastic/rebar3.mk) for full info
|
||||||
|
include rebar3.mk
|
||||||
|
|
||||||
|
compile: rebar3
|
||||||
$(REBAR) compile
|
$(REBAR) compile
|
||||||
|
|
||||||
update:
|
update: rebar3
|
||||||
$(REBAR) update
|
$(REBAR) update
|
||||||
|
|
||||||
test: compile
|
test: compile
|
||||||
|
@ -28,11 +28,9 @@ dev:
|
||||||
cd _checkouts; git clone https://github.com/choptastic/qdate_localtime
|
cd _checkouts; git clone https://github.com/choptastic/qdate_localtime
|
||||||
|
|
||||||
|
|
||||||
run:
|
run: rebar3
|
||||||
$(REBAR) shell
|
$(REBAR) shell
|
||||||
|
|
||||||
publish:
|
publish: rebar3
|
||||||
$(REBAR) as pkg upgrade
|
$(REBAR) hex publish
|
||||||
$(REBAR) as pkg hex publish
|
|
||||||
$(REBAR) upgrade
|
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
{deps,
|
{deps,
|
||||||
[
|
[
|
||||||
erlware_commons,
|
erlware_commons,
|
||||||
{qdate_localtime, "1.2.0"}
|
{qdate_localtime, "~> 1.2.0"}
|
||||||
]}.
|
]}.
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [
|
{applications, [
|
||||||
kernel,
|
kernel,
|
||||||
|
stdlib,
|
||||||
qdate_localtime,
|
qdate_localtime,
|
||||||
erlware_commons,
|
erlware_commons
|
||||||
stdlib
|
|
||||||
]},
|
]},
|
||||||
{modules, [qdate, qdate_srv, qdate_sup, qdate_app]},
|
{modules, [qdate, qdate_srv, qdate_sup, qdate_app]},
|
||||||
{env, []},
|
{env, []},
|
||||||
|
|
|
@ -152,8 +152,26 @@ unset_env(Key) ->
|
||||||
gen_server:call(?SERVER, {unset, ?KEY(Key)}).
|
gen_server:call(?SERVER, {unset, ?KEY(Key)}).
|
||||||
|
|
||||||
get_all_env(FilterTag) ->
|
get_all_env(FilterTag) ->
|
||||||
All = ets:tab2list(?TABLE),
|
try ets:tab2list(?TABLE) of
|
||||||
[{Key, V} || {{?BASETAG, {Tag, Key}}, V} <- All, Tag==FilterTag].
|
All ->
|
||||||
|
[{Key, V} || {{?BASETAG, {Tag, Key}}, V} <- All, Tag==FilterTag]
|
||||||
|
catch
|
||||||
|
error:badarg:S ->
|
||||||
|
Msg = maybe_start_msg(),
|
||||||
|
logger:error(Msg),
|
||||||
|
|
||||||
|
error({qdate_get_all_env_failed, #{
|
||||||
|
original_error => {error, badarg, S}
|
||||||
|
}})
|
||||||
|
end.
|
||||||
|
|
||||||
|
maybe_start_msg() ->
|
||||||
|
"Attempting to read qdate environment failed (qdate_srv:get_all_env/1).\n"
|
||||||
|
"qdate may not have been started properly.\n"
|
||||||
|
"Please ensure qdate is started properly by either:\n"
|
||||||
|
"* Putting qdate in the 'applications' key in your .app.src or .app file, or\n"
|
||||||
|
"* Starting it manually with application:ensure_all_started(qdate) or qdate:start().".
|
||||||
|
|
||||||
|
|
||||||
%% ProcDic Vars
|
%% ProcDic Vars
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue