init(_:uniquingKeysWith:) : Call can throw, but it is not marked with 'try' and the error is not handled

146 Views Asked by At

I have a doubt with rethrows. Following code is inside Dictionary extension:

init(_value: [(Key, Value)]) {
      self.init(_value, uniquingKeysWith: { _, first in first }) //Call can throw, but it is not           marked with 'try' and the error is not handled
    }

here uniquingKeysWith will not throw error as I am specifying the sequence, still compiler is telling "Call can throw, but it is not marked with 'try' and the error is not handled"

Can any one explain me why I need to handle error for the init when parameter is not throwing? As per rethrows concept if parameter uniquingKeysWith will not throw error then method does not need to handle errors.

0

There are 0 best solutions below