Editing a calendar import (e.g. by visiting /calendar/import/edit/1/) causes the following exception:
EXCEPTION: (TypeError) PhabricatorCalendarImport::initializeNewCalendarImport(): Argument #2 ($engine) must be of type PhabricatorCalendarImportEngine, null given, called in .../phabricator/src/applications/calendar/editor/PhabricatorCalendarImportEditEngine.php on line 44 at [<phabricator>/src/applications/calendar/storage/PhabricatorCalendarImport.php:26] arcanist(head=master, ref.master=82016c00e132), phabricator(head=master, ref.master=8daaf5ef2145) #0 phlog(TypeError) called at [<phabricator>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41] #1 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, TypeError) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:751] #2 AphrontApplicationConfiguration::handleThrowable(TypeError) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:296] #3 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:204] #4 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:35]
Depth | Library | File | Where | |
---|---|---|---|---|
10 | phabricator | applications/calendar/editor/PhabricatorCalendarImportEditEngine.php | 44 | PhabricatorCalendarImport::initializeNewCalendarImport() |
9 | phabricator | applications/transactions/editengine/PhabricatorEditEngine.php | 228 | PhabricatorCalendarImportEditEngine::newEditableObject() |
8 | phabricator | applications/transactions/engineextension/PhabricatorSubtypeEditEngineExtension.php | 24 | PhabricatorEditEngine::supportsSubtypes() |
7 | phabricator | applications/transactions/editengine/PhabricatorEditEngine.php | 184 | PhabricatorSubtypeEditEngineExtension::supportsObject() |
6 | phabricator | applications/transactions/editengine/PhabricatorEditEngine.php | 1036 | PhabricatorEditEngine::buildEditFields() |
5 | phabricator | applications/transactions/editengine/PhabricatorEditEngine.php | 998 | PhabricatorEditEngine::buildEditResponse() |
4 | phabricator | applications/calendar/controller/PhabricatorCalendarImportEditController.php | 27 | PhabricatorEditEngine::buildResponse() |
3 | phabricator | aphront/configuration/AphrontApplicationConfiguration.php | 284 | PhabricatorCalendarImportEditController::handleRequest() |
2 | phabricator | aphront/configuration/AphrontApplicationConfiguration.php | 204 | AphrontApplicationConfiguration::processRequest() |
1 | .../phabricator/webroot/index.php | 35 | AphrontApplicationConfiguration::runHTTPRequest() | |
The import engine is not set in frame 4, so it's null in the call to initializeNewCalendarImport in frame 10. This is frowned upon.
Possible solutions:
- Catch Error (or Throwable) in PhabricatorEditEngine. Since TypeError is not a subtype of Exception, it's not currently caught.
- If there is no import engine, throw an exception in PhabricatorCalendarImportEditEngine before initializing the import. This sort of thing happens in AlmanacService.
- Attach the import engine in PhabricatorCalendarImportEditEngine after initializing the import, rather than in PhabricatorCalendarImport. Prior art in DrydockBlueprintEditEngine.