Class: Neo4j::Driver::Types::UnresolvableZonedDateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/types/unresolvable_zoned_date_time.rb

Overview

A ZonedDateTime the driver received with a zone id its runtime's time zone database can't resolve (e.g. the server sent "Europe/Neo4j").

Hydration can't build a real Time, but raising mid-record on the reader thread would break the connection and strand the whole result — so the failure is deferred into this placeholder. Any consumer that tries to interpret the value raises (naming the zone), matching the Java driver, while the record and connection stay intact so an open transaction can still roll back cleanly.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zone_name) ⇒ UnresolvableZonedDateTime

Returns a new instance of UnresolvableZonedDateTime.



18
19
20
# File 'lib/neo4j/driver/types/unresolvable_zoned_date_time.rb', line 18

def initialize(zone_name)
  @zone_name = zone_name
end

Instance Attribute Details

#zone_nameObject (readonly)

Returns the value of attribute zone_name.



16
17
18
# File 'lib/neo4j/driver/types/unresolvable_zoned_date_time.rb', line 16

def zone_name
  @zone_name
end

Instance Method Details

#errorObject

The driver error this value stands in for. Raised by any consumer that tries to use it (the testkit backend on serialize; a public-API caller via #value).



25
26
27
28
29
30
# File 'lib/neo4j/driver/types/unresolvable_zoned_date_time.rb', line 25

def error
  Exceptions::ClientException.new(
    "The server returned a ZonedDateTime with a zone id (#{@zone_name.inspect}) " \
    "that this runtime's time zone database does not recognise"
  )
end

#valueObject



32
33
34
# File 'lib/neo4j/driver/types/unresolvable_zoned_date_time.rb', line 32

def value
  raise error
end