Skip to content

Commit 4f774dc

Browse files
committed
even nicer implementation
1 parent 8d7fe75 commit 4f774dc

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/parsing.jl

+5-7
Original file line numberDiff line numberDiff line change
@@ -295,17 +295,15 @@ end
295295

296296
_DEFAULT_TYPE_MAP[:time] = Time
297297
function pqparse(::Type{Time}, str::AbstractString)
298+
result = nothing
298299
try
299-
return parse(Time, str)
300+
result = tryparse(Time, str)
300301
catch err
301-
try
302-
return parse(Time, _trunc_seconds(str))
303-
catch
304-
if !(err isa InexactError)
305-
rethrow(err)
306-
end
302+
if !(err isa InexactError)
303+
rethrow(err)
307304
end
308305
end
306+
return isnothing(result) ? parse(Time, _trunc_seconds(str)) : result
309307
end
310308

311309
# InfExtendedTime support for Dates.TimeType

0 commit comments

Comments
 (0)