diff options
-rw-r--r-- | posixtz.lua | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/posixtz.lua b/posixtz.lua index ae84275..eb1e56e 100644 --- a/posixtz.lua +++ b/posixtz.lua @@ -13,7 +13,6 @@ -- Import Section -- declare everything this module needs from outside -local error = error local tonumber = tonumber local pairs = pairs local ipairs = ipairs @@ -33,7 +32,7 @@ function parse ( str ) local temp = {} if not str then - error('Nothing to parse') + return nil, 'Nothing to parse' end @@ -50,7 +49,7 @@ function parse ( str ) -- tz.std must be defined by now if not tz.std then - error('Not a valid POSIX TZ. "std" invalid') + return nil, 'Not a valid POSIX TZ. "std" invalid' end @@ -73,7 +72,7 @@ function parse ( str ) end else - error('Not a valid POSIX TZ. "offset" invalid') + return nil, 'Not a valid POSIX TZ. "offset" invalid' end @@ -95,14 +94,14 @@ function parse ( str ) tz.dst.name, temp.afterdst = string.match(temp.afteroffset, '^(%a+)(.*)') end if not tz.dst.name then - error('Not a valid POSIX TZ. "dst" present but not valid') + return nil, 'Not a valid POSIX TZ. "dst" present but not valid' end -- tz.dst.name is defined, so process "rule" -- Parse out specifications from "rule" temp.dststart, temp.dststop = string.match(temp.afterdst, '^,([^,]+),([^,]+)') if not temp.dststart then - error('Not a valid POSIX TZ. "dst" present but "rule" is not') + return nil, 'Not a valid POSIX TZ. "dst" present but "rule" is not' end @@ -178,7 +177,7 @@ function parse ( str ) -- Validation: t.month must be defined by now. if not t.month then - error('Not a valid POSIX TZ. "rule" for DST "'..pos..'" is invalid') + return nil, 'Not a valid POSIX TZ. "rule" for DST "'..pos..'" is invalid' end end |