lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb in adiwg-mdtranslator-2.13.0 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb in adiwg-mdtranslator-2.13.1
- old
+ new
@@ -1,10 +1,10 @@
# unpack dateTime
# Reader - ADIwg JSON V1 to internal data structure
# History:
-# Stan Smith 2018-02-18 refactored error and warning messaging
+# Stan Smith 2018-06-18 refactored error and warning messaging
# Stan Smith 2016-10-05 refactored for mdJson 2.0
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
# Stan Smith 2015-07-14 refactored to remove global namespace constants
# Stan Smith 2013-12-11 original script
@@ -16,15 +16,17 @@
module Readers
module MdJson
module DateTime
- def self.unpack(sDateTime, responseObj)
+ def self.unpack(sDateTime, responseObj, inContext = nil)
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
+
# return nil object if input is empty
if sDateTime == ''
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: dateTime string is empty'
+ @MessagePath.issueWarning(160, responseObj, inContext)
return nil
end
# instance classes needed in script
intMetadataClass = InternalMetadata.new
@@ -32,12 +34,10 @@
# dateTime - dateTime (required)
# if dateTimeFromString fails, [0] = nil; [1] = 'ERROR'
aDateTimeReturn = AdiwgDateTimeFun.dateTimeFromString(sDateTime)
if aDateTimeReturn[1] == 'ERROR'
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: dateTime string is invalid'
- responseObj[:readerExecutionPass] = false
- return nil
+ @MessagePath.issueError(161, responseObj, inContext)
else
intDateTime[:dateTime] = aDateTimeReturn[0]
intDateTime[:dateResolution] = aDateTimeReturn[1]
end
\ No newline at end of file