From 563dc2a993ec184a64b2f4652504ef01e875f6b9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 17 Sep 2020 13:11:23 -0700 Subject: [PATCH] In ConduitCallFuture, only call Conduit exception messages on Conduit exceptions Summary: Ref T13582. When this code is reached with a raw HTTP exception, it currently fatals. Test Plan: - Ran `arc branches --conduit-uri=http://example.org` (a bad Conduit URI). - Before: hard fatal with a bad method call. - After: non-Conduit exception raised to user. Not ideal, but a step forward. Maniphest Tasks: T13582 Differential Revision: https://secure.phabricator.com/D21467 --- src/conduit/ArcanistConduitCallFuture.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/conduit/ArcanistConduitCallFuture.php b/src/conduit/ArcanistConduitCallFuture.php index 187b4c27..2f3dad07 100644 --- a/src/conduit/ArcanistConduitCallFuture.php +++ b/src/conduit/ArcanistConduitCallFuture.php @@ -72,15 +72,18 @@ final class ArcanistConduitCallFuture } protected function didReceiveException($exception) { - switch ($exception->getErrorCode()) { - case 'ERR-INVALID-SESSION': - if (!$this->getEngine()->getConduitToken()) { - $this->raiseLoginRequired(); - } - break; - case 'ERR-INVALID-AUTH': - $this->raiseInvalidAuth(); - break; + + if ($exception instanceof ConduitClientException) { + switch ($exception->getErrorCode()) { + case 'ERR-INVALID-SESSION': + if (!$this->getEngine()->getConduitToken()) { + $this->raiseLoginRequired(); + } + break; + case 'ERR-INVALID-AUTH': + $this->raiseInvalidAuth(); + break; + } } throw $exception;