Skip to content

Improve error handling during email setup, when admin user didn't set a personal email yet #56609

@SimJoSt

Description

@SimJoSt

Tip

Help move this idea forward

  • Use the 👍 reaction to show support for this feature.
  • Avoid commenting unless you have relevant information to add; unnecessary comments create noise for subscribers.
  • Subscribe to receive notifications about status changes and new comments.

Is your feature request related to a problem? Please describe.

When setting up email sending in the "Basic Settings" (/settings/admin) and section "Email server", the "Send email" test can fail with the error:

AxiosError: Request failed with status code 400

This is the result of the POST request to /settings/admin/mailtest with a 400 (HTTP Bad Request) response, due to the current account not having set an email address yet.
The reason for the error is not shown, nor does it get logged in the Nextcloud server logs.

Only checking the response of the failed request in the browser developer console network tab, reveals the following:

"You need to set your account email before being able to send test emails. Go to https://cloud.example.com/settings/user for that."

Setting an email in the "Personal info" (/settings/user) menu, resolves the issue.

Describe the solution you'd like

I would like the issue to be easier to debug, this means making the issue more transparent to the user.

  1. Show the error description in the frontend, instead of only the XHR library error.
  2. Log the error on the server too, so it appears in the Nextcloud log.
  3. Possibly, change the HTTP code to something more fitting, as the request itself is not "Bad", but a requirement is not fulfilled.

Describe alternatives you've considered

Add more hints in docs and the web interface to indicate the requirement:

Additional context

This specific error is discussed in multiple places. As it seems like the same error can also be caused by other things, the advice is mixed and not everybody finds a solution.

Source code:

Docs:
If necessary, the Axios docs for custom errors: https://axios-http.com/docs/handling_errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapenhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions