protected function ascertainMetadata(string $handlerName, ?string $httpMethod = null): void
	{
		if (empty($this->handlerClassNames[$handlerName]))
		{
			try
			{
				$this->loadMetadata($handlerName);
				$this->needCacheUpdate = true;
			}
			catch (\Throwable $e)
			{
				//Reset all metadata
				[
					$this->handlerClassNames,
					$this->routes,
					$this->handlerMethodNames,
					$this->consumers,
					$this->attributes,
					$this->producers
				] = [[], [], [], [], [], []];
				throw $e;
			}
		}

		if (($httpMethod !== null) && empty($this->handlerMethodNames[$this->handlerClassNames[$handlerName]][$httpMethod]))
		{
			throw new \InvalidArgumentException(\sprintf(
				'Handler %s is not configured to handle %s-method.', $handlerName, $httpMethod
			));
		}
	}