Skip to content
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

Files app ajax call exception must be shown in popup #5226

Closed
PVince81 opened this issue Oct 9, 2013 · 10 comments
Closed

Files app ajax call exception must be shown in popup #5226

PVince81 opened this issue Oct 9, 2013 · 10 comments
Assignees

Comments

@PVince81
Copy link
Contributor

PVince81 commented Oct 9, 2013

Steps to reproduce

Hard to reproduce, but met while working on #5199

  1. Follow the steps in that ticket
  2. At some point you'll have to click on the external storage mount subdir
  3. list.php will return an exception in the form of an HTML page

Expected result

Exception / stack trace shown in popup dialog

Actual result

Fails silently and stays in the same directory (and URL points to the wrong subdir)

Ideally the server should return the strack trace inside a JSON object instead of returning a whole HTML page when calling in ajax mode. This can be detected from the XmlHttpRequest headers.

@ghost ghost assigned PVince81 Oct 9, 2013
@DeepDiver1975
Copy link
Member

there is a try catch block in index.php - any unhandled exception will go in there.
Currently we simply generate an html error page - but we should honor the accept header and return at least json if requested.
Maybe xml would be valid for OCS calls @karlitschek

@karlitschek
Copy link
Contributor

great idea. I'm not sure if this is a topic for OCS because this is only for debugging as far as i understand.

@DeepDiver1975
Copy link
Member

this is only for debugging

It will help while debugging but it will also help in regular/productive operations where exceptions are no handled properly in the code.

@PVince81
Copy link
Contributor Author

Ideally I'd like to return JSON for when the call is made using Ajax.
Is there a way to detect when a call is made to the API ? Does it go through index.php at all or are OCS API calls going through another script ?

@karlitschek
Copy link
Contributor

Can you explain the usecase why we want to expos this via a public REST api? I can't see it at the moment.

@PVince81
Copy link
Contributor Author

I think what @DeepDiver1975 means is that if you make a REST API call and that one causes an exception on the server, that you'd still get a stack trace (or at least the exception's message) in the response instead of... whatever is returned now ?

I'd say we can consider this as a separate use case / issue.

In this ticket I'd prefer to focus on showing the exceptions caused by ajax calls in the UI.

@karlitschek
Copy link
Contributor

yes please.

PVince81 pushed a commit that referenced this issue Oct 10, 2013
All failed ajax calls in the app will display an exception dialog.
This is achieved using a global listener to "ajaxError".
The dialog will show the exception returned by the server in JSON format
with a stack trace if available.

Fixes #5226
@PVince81
Copy link
Contributor Author

After discussing it with @tanghus we decided to go with just logging the stack trace.
This is done in #5478

@DeepDiver1975
Copy link
Member

@PVince81 this can be closed - right?

@PVince81
Copy link
Contributor Author

Closing

@lock lock bot locked as resolved and limited conversation to collaborators Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants