Skip to content

Commit

Permalink
Expose exception message in the response
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Dec 20, 2019
1 parent 4ff11e3 commit 0ddb9c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/files/lib/Controller/DirectEditingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function create(string $path, string $editorId, string $creatorId, string
]);
} catch (Exception $e) {
$this->logger->logException($e, ['message' => 'Exception when creating a new file through direct editing']);
return new DataResponse('Failed to create file', Http::STATUS_FORBIDDEN);
return new DataResponse('Failed to create file: ' . $e->getMessage(), Http::STATUS_FORBIDDEN);
}
}

Expand All @@ -106,7 +106,7 @@ public function open(string $path, string $editorId = null): DataResponse {
]);
} catch (Exception $e) {
$this->logger->logException($e, ['message' => 'Exception when opening a file through direct editing']);
return new DataResponse('Failed to open file', Http::STATUS_FORBIDDEN);
return new DataResponse('Failed to open file: ' . $e->getMessage(), Http::STATUS_FORBIDDEN);
}
}

Expand All @@ -122,7 +122,7 @@ public function templates(string $editorId, string $creatorId): DataResponse {
return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId));
} catch (Exception $e) {
$this->logger->logException($e);
return new DataResponse('Failed to open file', Http::STATUS_INTERNAL_SERVER_ERROR);
return new DataResponse('Failed to obtain template list: ' . $e->getMessage(), Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
}

0 comments on commit 0ddb9c0

Please sign in to comment.