-
Notifications
You must be signed in to change notification settings - Fork 1
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 #11
Comments
Slightly disagree still. We have to determine the severity level of each of the errors in the context of when they are called. For example, consider the error of 404. They can be returned in these ways:
|
Of all of those, the majority are things the frontend should block. In cases where the frontend should not block it, I disagree that we need to log it internally, but rather the frontend should display a better error message - currently it just displays something like "Error in METHOD to ROUTE: 400 bad request". Instead, the frontend should use the response text as the backend always provides a response explaining the error for 400s. In the case of Hashir's report, realistically I think that user just typo'd the persons shortcode. I don't think this is to do with Safari nor something we need(ed) to test. Had the frontend propogated the backend error correctly, we wouldn't have needed to receive a report. All this being said, I did find a few places where the backend should be logging that it's not logging, but overall logging 400s would just add clutter, it's 500s that should be (and are) logged. Anyways, this is next year webmasters problem now hahahah unless me or you get bored. |
When deciding whether to explicitly log 4xx errors (client-side errors) in server logs, there are both advantages and disadvantages. Here's a breakdown of the arguments for and against: For Logging 4xx Errors
Against Logging 4xx Errors
ConclusionWhether or not to log 4xx errors depends on the specific use case. In environments where security, API health, and client behavior monitoring are important, logging 4xx errors can provide valuable insights. However, in high-traffic systems or where client errors are expected, they might be best logged selectively or handled on the client side to reduce noise and protect sensitive information. A balanced approach would be to log 4xx errors conditionally based on severity (e.g., log only when 401 or 403 errors occur) or to aggregate certain types of 4xx errors without storing excessive details. TL;DR ChatGPT sides with me based on the comprise after hearing your opinion. We should log the 4xx errors too depending on the severity of the problem. Although in no way I am saying don't improve the error reporting on the frontend. Infact revealing the route like EDIT: It now a job to understand how to know what parts of the codebase result in a low/high severity 4xx problems. If the user has an expired token, it is normal for 403 to return, but if there are multiple 403 requests with the user not sending in any token, or a token not in db. it's something to think about. But that has increased code complexity which may not be needed. I am not solely thinking about mad3 but also web development in general (also with my mind polluted with ichack) |
Re security: In a more general case, I do agree that people trying to access restricted routes and getting a 404 should be logged, though I know I have done that before and it's pure curiosity, not malice hahah. I think the more standard thing, however, is to use tools such as fail2ban to handle that. ChatGPTs point 2. of improving UX etc isn't a bad idea - having some logging for statistics on each request etc - though a little out of our scope. I disagree with 3/4 for us. Re: your edit, we can specifically log expired tokens as we clear your token when it's expired to tell the difference. Understandable last point, though I do think it's more of a by-project thing (even, by specific route and specific errors) rather than a web dev in general thing. |
The server logs don't have much to decipher about the request and why it failed. This includes
The text was updated successfully, but these errors were encountered: