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.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
EIFGENs
|
||||
*.swp
|
||||
*.log*
|
||||
*.rc
|
||||
*.rc
|
||||
*.bak
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ feature -- Execution
|
||||
process
|
||||
-- Computed response message.
|
||||
do
|
||||
set_title (Void)
|
||||
set_title ("Home")
|
||||
set_page_title (Void)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user