From a9109ca8f716434478febd4c52935f027e10b44a Mon Sep 17 00:00:00 2001 From: jvelilla Date: Wed, 26 Nov 2014 13:57:04 -0300 Subject: [PATCH] Updated CMS_SMARTY_TEMPALTE_BLOCK, redefined out to be used by the logger. Updated CMS_API, added wrapper features to access error_handler. has_error, reset, as_string_representation, hide the actual error hanlder implementation. Updated Error Filter with better logging. --- .gitignore | 3 +- .../content/cms_smarty_template_block.e | 42 ++++++++++++++++++- library/src/service/cms_api.e | 24 ++++++++++- library/src/service/filter/cms_error_filter.e | 14 +++++-- .../src/service/response/home_cms_response.e | 2 +- 5 files changed, 76 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 1878f3d..3d99381 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ EIFGENs *.swp *.log* -*.rc \ No newline at end of file +*.rc +*.bak \ No newline at end of file diff --git a/library/src/kernel/content/cms_smarty_template_block.e b/library/src/kernel/content/cms_smarty_template_block.e index a433512..3f236a1 100644 --- a/library/src/kernel/content/cms_smarty_template_block.e +++ b/library/src/kernel/content/cms_smarty_template_block.e @@ -2,7 +2,7 @@ note description: "[ CMS block with smarty template file content. ]" - date: "$Date: 2014-11-14 20:11:17 +0100 (ven., 14 nov. 2014) $" + date: "$Date: 2014-11-14 16:11:17 -0300 (vi. 14 de nov. de 2014) $" revision: "$Revision: 96092 $" class @@ -10,8 +10,15 @@ class inherit CMS_BLOCK - + redefine + out + select + out + end SHARED_TEMPLATE_CONTEXT + rename + out as tpl_out + end create make, @@ -145,4 +152,35 @@ feature -- Conversion end end +feature -- Debug + + out: STRING + do + create Result.make_from_string (generator) + Result.append ("%Nname:") + Result.append (name) + if attached title as l_title then + Result.append ("%N%Ttitle:") + Result.append (l_title) + end + Result.append ("%Nlocation:") + Result.append (location.out) + Result.append ("%Ntemplate_root_path:") + Result.append (template_root_path.out) + Result.append ("%NValues: {") + from + values.start + until + values.after + loop + Result.append ("%NKey:") + Result.append (values.key_for_iteration.as_string_8) + Result.append (" - Value:") + if attached values.item_for_iteration as l_item then + Result.append (l_item.out) + end + values.forth + end + Result.append ("%N}") + end end diff --git a/library/src/service/cms_api.e b/library/src/service/cms_api.e index 39d8e6e..56a372f 100644 --- a/library/src/service/cms_api.e +++ b/library/src/service/cms_api.e @@ -73,7 +73,29 @@ feature -- Initialize retry end -feature -- Access +feature -- Access: Error + + has_error: BOOLEAN + -- Has error? + do + Result := error_handler.has_error + end + + as_string_representation: STRING_32 + -- String representation of all error(s). + do + Result := error_handler.as_string_representation + end + +feature -- Element Change: Error + + reset + -- Reset error handler. + do + error_handler.reset + end + +feature {NONE}-- Error handler implemenations error_handler: ERROR_HANDLER -- Error handler. diff --git a/library/src/service/filter/cms_error_filter.e b/library/src/service/filter/cms_error_filter.e index ffef78f..337e87e 100644 --- a/library/src/service/filter/cms_error_filter.e +++ b/library/src/service/filter/cms_error_filter.e @@ -21,13 +21,19 @@ feature -- Basic operations -- Execute the filter do fixme ("Check if it's ok to add new fetures CMS_API.has_error:BOOLEAN and CMS_API.error_description.") - if not api.error_handler.has_error then - log.write_information (generator + ".execute") + if not api.has_error then + log.write_information (generator + ".execute with req: " + req.debug_output) + if attached req.raw_header_data as l_header_data then + log.write_debug (generator + ".execute with req header: " + l_header_data) + end + if attached req.raw_input_data as l_input_data then + log.write_debug (generator + ".execute with req input: " + l_input_data) + end execute_next (req, res) else - log.write_critical (generator + ".execute" + api.error_handler.as_string_representation ) + log.write_critical (generator + ".execute" + api.as_string_representation ) (create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).execute - api.error_handler.reset + api.reset end end diff --git a/library/src/service/response/home_cms_response.e b/library/src/service/response/home_cms_response.e index 78e9347..f82caec 100644 --- a/library/src/service/response/home_cms_response.e +++ b/library/src/service/response/home_cms_response.e @@ -29,7 +29,7 @@ feature -- Execution process -- Computed response message. do - set_title (Void) + set_title ("Home") set_page_title (Void) end end