private function firstTagOr($errorMessage, $name) { try { if (!isset($this->tags[$name])) { throw new \Exception('Tag not found.'); } return Either::right(Arrays::head($this->tags[$name])); } catch (\Exception $e) { return Either::left($errorMessage); } }