@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Conduit: Improve error handling calling file.uploadchunk/file.querychunks without PHID

Summary: Throw a proper error code and error_info, like similar `file.download` and `file.info` already do.

Test Plan:
* Go to http://phorge.localhost/conduit/method/file.uploadchunk and http://phorge.localhost/conduit/method/file.querychunks , click "Call Method"
* Before this patch, get a generic "ERR-CONDUIT-CORE" error code.
* After this patch, get a "ERR-BAD-PHID" error code and the error info `No such file exists.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D26754

+18
+9
src/applications/files/conduit/FileQueryChunksConduitAPIMethod.php
··· 21 21 return 'list<wild>'; 22 22 } 23 23 24 + protected function defineErrorTypes() { 25 + return array( 26 + 'ERR-BAD-PHID' => pht('Must pass a PHID.'), 27 + ); 28 + } 29 + 24 30 protected function execute(ConduitAPIRequest $request) { 25 31 $viewer = $request->getUser(); 26 32 27 33 $file_phid = $request->getValue('filePHID'); 34 + if (!$file_phid) { 35 + throw new ConduitException('ERR-BAD-PHID'); 36 + } 28 37 $file = $this->loadFileByPHID($viewer, $file_phid); 29 38 $chunks = $this->loadFileChunks($viewer, $file); 30 39
+9
src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php
··· 24 24 return 'void'; 25 25 } 26 26 27 + protected function defineErrorTypes() { 28 + return array( 29 + 'ERR-BAD-PHID' => pht('Must pass a PHID.'), 30 + ); 31 + } 32 + 27 33 protected function execute(ConduitAPIRequest $request) { 28 34 $viewer = $request->getUser(); 29 35 30 36 $file_phid = $request->getValue('filePHID'); 37 + if (!$file_phid) { 38 + throw new ConduitException('ERR-BAD-PHID'); 39 + } 31 40 $file = $this->loadFileByPHID($viewer, $file_phid); 32 41 33 42 $start = $request->getValue('byteStart');