Opened 11 years ago

#6363 new Bugs

Incorrect error documentation for time_zone_from_region() in tz_db_base.hpp

Reported by: nickbp@… Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

In the event of an error, time_zone_from_region()'s documentation is incorrect in the following ways:

  • The function returns a null pointer. It does not throw an exception.
  • The specified "record_not_found" exception does not exist.

Here's the doc/code in question (identical in at least 1.46.0-1.48.0):

      //! Returns a time_zone object built from the specs for the given region
      /*! Returns a time_zone object built from the specs for the given 
       * region. If region does not exist a local_time::record_not_found 
       * exception will be thrown */
      boost::shared_ptr<time_zone_base_type> 
      time_zone_from_region(const string_type& region) const 
      {
        // get the record
        typename map_type::const_iterator record = m_zone_map.find(region);
        if(record == m_zone_map.end()){
          return boost::shared_ptr<time_zone_base_type>(); //null pointer
        }
        return record->second;
      }

Change History (0)

Note: See TracTickets for help on using tickets.