Handle more error cases

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2017-05-01 18:41:37 -03:00 committed by Robin Appelman
parent 6aac094091
commit 23cc309606
No known key found for this signature in database
GPG key ID: CBCA68FBAEBF98C9
4 changed files with 8 additions and 0 deletions

View file

@ -97,6 +97,8 @@ class PublicPreviewController extends Controller {
return new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); return new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND); return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\InvalidArgumentException $e) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
} }
} }
} }

View file

@ -114,6 +114,8 @@ class PreviewController extends Controller {
return new Http\FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); return new Http\FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND); return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\InvalidArgumentException $e) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
} }
} }
} }

View file

@ -94,6 +94,8 @@ class PreviewController extends Controller {
return new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]); return new FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND); return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\InvalidArgumentException $e) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
} }
} }
} }

View file

@ -126,6 +126,8 @@ class PreviewController extends Controller {
return $response; return $response;
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND); return new DataResponse([], Http::STATUS_NOT_FOUND);
} catch (\InvalidArgumentException $e) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
} }
} }