Skip to content

Commit

Permalink
Merge pull request #671 from danikp/master
Browse files Browse the repository at this point in the history
beta1
  • Loading branch information
danikp committed Aug 19, 2017
2 parents be5a7cc + c1a1b54 commit 6397c5e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
40 changes: 20 additions & 20 deletions src/boss/boss_web.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
-define(DEBUGPRINT(A), error_logger:info_report("~~o)> " ++ A)).
-define(BUILTIN_CONTROLLER_FILTERS, [boss_lang_filter, boss_cache_page_filter, boss_cache_vars_filter]).
-define(PRINT(N,V),
lager:notice(" ~s ~p", [ N,V])).
lager:notice(" ~s ~p", [ N,V])).
-include_lib("eunit/include/eunit.hrl").

-record(boss_app_info, {
application ::atom(),
base_url ::string(),
static_prefix ::string(),
doc_prefix ::string(),
domains ::all|[string()],
init_data ::[{atom(), any()}] ,
router_sup_pid ::pid(),
router_pid ::pid(),
translator_sup_pid ::pid(),
translator_pid ::pid(),
model_modules = [] ::[atom()],
view_modules = [] ::[atom()],
controller_modules = [] ::[atom()]
application :: atom(),
base_url :: 'undefined' | string(),
static_prefix :: 'undefined' | string(),
doc_prefix :: 'undefined' | string(),
domains :: 'undefined' | 'all' | [string()],
init_data :: 'undefined' | [{atom(), any()}] ,
router_sup_pid :: 'undefined' | pid(),
router_pid :: 'undefined' | pid(),
translator_sup_pid :: 'undefined' | pid(),
translator_pid :: 'undefined' | pid(),
model_modules = [] :: [atom()],
view_modules = [] :: [atom()],
controller_modules = [] :: [atom()]
}).

-record(state, {
applications = [] ::[ #boss_app_info{}],
router_adapter ::atom(),
service_sup_pid ::pid(),
http_pid ::pid(),
smtp_pid ::pid(),
is_master_node = false ::boolean()
applications = [] :: [ #boss_app_info{}],
router_adapter :: atom(),
service_sup_pid :: pid(),
http_pid :: pid(),
smtp_pid :: pid(),
is_master_node = false :: boolean()
}).


Expand Down
21 changes: 19 additions & 2 deletions src/boss/boss_web_controller_render.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,22 @@
-spec process_action_result({_,_,nonempty_maybe_improper_list()},_,[],_) -> any().
-spec process_location(_,nonempty_maybe_improper_list(),#boss_app_info{}) -> {_,string(),_}.
-spec process_redirect(_,_,_) -> any().
-spec render_error(_,_,#boss_app_info{application::atom(),base_url::'undefined' | string(),static_prefix::'undefined' | string(),doc_prefix::'undefined' | string(),domains::'all' | 'undefined' | [string()],init_data::'undefined' | [{atom(),_}],router_sup_pid::'undefined' | pid(),router_pid::'undefined' | pid(),translator_sup_pid::'undefined' | pid(),translator_pid::'undefined' | pid(),model_modules::[atom()],view_modules::[atom()],controller_modules::[atom()]},[any()]) -> {'error',_} | {'error',[any()],[]}.
-spec render_error(_, _,
#boss_app_info{
application :: atom(),
base_url :: 'undefined' | string(),
static_prefix :: 'undefined' | string(),
doc_prefix :: 'undefined' | string(),
domains :: 'all' | 'undefined' | [string()],
init_data :: 'undefined' | [{atom(),_}],
router_sup_pid :: 'undefined' | pid(),
router_pid :: 'undefined' | pid(),
translator_sup_pid :: 'undefined' | pid(),
translator_pid :: 'undefined' | pid(),
model_modules :: [atom()],
view_modules :: [atom()],
controller_modules :: [atom()]
},[any()]) -> {'error',_} | {'error',[any()],[]}.
-spec render_errors(_,#boss_app_info{},[any()]) -> any().
-spec render_result(_,_,_,_,_,_,_,_) -> any().
-spec render_view({_,_,_},_,[any()]) -> any().
Expand All @@ -46,7 +61,9 @@
%% (seems to be called on runtime error)
render_error(Error, ExtraMessage, AppInfo, RequestContext) ->
case boss_html_error_template:render(RequestContext ++ [
{error, Error}, {extra_message, ExtraMessage}, {appinfo, AppInfo},
{error, Error},
{extra_message, ExtraMessage},
{appinfo, AppInfo},
{'_base_url', AppInfo#boss_app_info.base_url},
{'_static', AppInfo#boss_app_info.static_prefix}]) of
{ok, Payload} ->
Expand Down

0 comments on commit 6397c5e

Please sign in to comment.