Re: [JGIT PATCH] Disambiguate "push not supported" from "repository not found"
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Aug 29, 2008, 14:31 UTC
- Message-ID
- <20080829143116.GB7403@spearce.org>
- In-Reply-To
- <48B7E927.2000205@gmail.com>
Marek Zawirski <marek.zawirski@gmail.com> wrote:
Show 17 quoted lines
> Robin Rosenberg wrote:
>> fredagen den 29 augusti 2008 02.18.38 skrev Shawn O. Pearce:
>>> + if (avail.isEmpty())
>>> + throw noRepository();
>>> throw eof;
>>> }
>>> @@ -185,6 +182,10 @@ else if (this instanceof FetchConnection)
>>> available(avail);
>>> }
>>> + protected TransportException noRepository() {
>>> + return new NoRemoteRepositoryException(uri, "not found.");
>>> + }
>>> +
>>
>> Why an extra method for instantiating the exception?
>
> Isn't it overrode in subclass - BasePackPushConnection?Correct. I introduced the method so the subclass can inject its own implementation for the catch block. But its required to give back a TransportException so the catch block can throw it, as we do not want the subclass to be able to continue at this point.
-- Shawn.