-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#40969] show correct error message in files tab #49
[#40969] show correct error message in files tab #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. We never show technical errors to the user in Nextcloud but we log them.
So we could display a "human readable" standard error message in the UI but log the real error message as a server-side warning log and optionally in the browser logs.
Why do you want the user to potentially see a CURL error?
3455027
to
2e75531
Compare
$body = $response->getBody(); | ||
$respCode = $response->getStatusCode(); | ||
|
||
if ($respCode >= 400) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the response code should never be >= 400 here because that would throw a Client or ServerException and that is handled lower
return [ | ||
'error' => $e->getMessage(), | ||
'statusCode' => 404, | ||
]; | ||
} catch (Exception $e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code should actually never come here, because realistic exceptions are handled higher up, but still I would like to leave that catch just in case
@eneiluj I've refactored the PR, so that the user only sees "readable" messages, see screenshots in the first post. Please review again |
485a98d
to
f55dc75
Compare
https://community.openproject.org/work_packages/40969 Signed-off-by: Artur Neumann <artur@jankaritech.com>
f55dc75
to
a666389
Compare
JS Code CoverageCoverage after merging task/40969-better-error-messages-in-case-of-openproject-connection-issue into master will be
Coverage Report |
This turned into a bit of refactoring for passing around error messages.
Now we have these options that can happen:
When OpenProject server is not reachable
![grafik](https://user-images.githubusercontent.com/2425577/155307899-7040f51a-1475-4b1b-878e-2f073e14f2be.png)
OpenProject does not support the filter (what is currently always the case, because its not implemented yet)
![grafik](https://user-images.githubusercontent.com/2425577/155307830-5b2ab626-a5ce-4a98-b420-6ecbbec5c203.png)
No OAuth connection to OpenProject, because the connection was not established yet
![grafik](https://user-images.githubusercontent.com/2425577/154620336-d24825a9-5f8e-4334-9a2a-823720c6f818.png)