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

Improve error handling (fixes #897) #1013

Closed
wants to merge 1 commit into from
Closed

Improve error handling (fixes #897) #1013

wants to merge 1 commit into from

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented May 12, 2023

A lot of routes are missing basic checks, for example /setup is publicly available even after the site is created. For pages which require auth, the check is handled separately each time when it could be done once at the top level. This is currently work in progress to see if Im on the right track. The same checks should be added to many more routes.

res.status(500);
formatted = err;
}
res.send(formatted);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be improved further by displaying the error message as a full page with normal header and footer (if site was requested successfully). In case of error 401 it can also redirect to /login like some routes already do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first part was mentioned in #982. If you don't do it as part of this PR, I could whip something up. I'm wondering: if the site returns a server error but the site is still fetched, is it a good idea to list the matrix user IDs of instance admins for users to reach out to for support? That information is already on the site response, so no further requests would be required.

@@ -60,6 +61,8 @@ export class AdminSettings extends Component<any, AdminSettingsState> {
this.parseMessage = this.parseMessage.bind(this);
this.subscription = wsSubscribe(this.parseMessage);

check_auth();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this on the client, I think it would better to handle this on the server and redirect the user before even sending the page that requires auth back.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest Im not good at frontend dev. If you want you can take over this PR because it takes me forever just to implement the basics. So Id rather stay in Rust :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants