Skip to content

Commit

Permalink
Tor: Throw TorStartupFailedException when start-up fails
Browse files Browse the repository at this point in the history
  • Loading branch information
alvasw committed Aug 8, 2023
1 parent 22f6c25 commit 5d932b2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
10 changes: 7 additions & 3 deletions network/tor/src/main/java/bisq/tor/process/NativeTorProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public NativeTorProcess(Path torrcPath) {
this.torrcPath = torrcPath;
}

public void start() throws IOException {
public void start() {
String absoluteTorrcPathAsString = torrcPath.toAbsolutePath().toString();

String ownerPid = Pid.getMyPid();
Expand All @@ -57,8 +57,12 @@ public void start() throws IOException {

logFileCreationWaiter = Optional.of(createLogFileCreationWaiter());

Process torProcess = processBuilder.start();
process = Optional.of(torProcess);
try {
Process torProcess = processBuilder.start();
process = Optional.of(torProcess);
} catch (IOException e) {
throw new TorStartupFailedException(e);
}
}

public void waitUntilControlPortReady() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.tor.process;

public class TorStartupFailedException extends RuntimeException {
public TorStartupFailedException(Throwable cause) {
super(cause);
}
}

0 comments on commit 5d932b2

Please sign in to comment.