Skip to content

Plain error messages #18

@tracey-le

Description

@tracey-le

Awesome that we have descriptive error messages coming up to notify users 👍

Some of them come out as plain on a separate HTML page. It's not a bug - it's done intentionally - but @liamcal suggested we could add to the UX for those 🙂

Here is a pic:
screen shot 2017-01-24 at 4 04 04 pm

List of error messages that come out as plain on a separate HTML page:

  • Username already exists after you choose a username that is already taken/if you choose a username that is not unique, on sign up page (user.py).

    Thanks to @Jackywathy on set up ajax on serverside and just-in-time testing for unique usernames

  • Email is already registered if the email you use is already in the db

    Again thanks to Jack! here in this commit 1f59c7e

  • Username and password do not match from sign in (user.py)

  • Username cannot be found from sign in (user.py)

  • Uploaded file type not supported when image type for uploaded profile pic or post image is not valid (user.py, ask.py)

    signup page fix e09d7d9 & ask page fix 7f73aeb

  • We couldn't find an uploaded file if no image is uploaded to post (user.py, ask.py)

    edit: profile pic isn't necessary on sign up. fixed for ask page 7f73aeb

  • You are not logged in if you try to post a comment without being logged in (view.py)

    Yay d19d596 It prevents you from posting a comment in the first place if you're not logged in.

    Actually something we could do here is not allow the user to post a comment front end (disable input field or anything) if there is no user_cookie, I'll look into that.

  • Username is not in db if you try to go to a URL of a profile that doesn't exist (profile.py)

The file name in brackets for items in the list indicates in which file(s) the message is being written. (I haven't actually gotten to verify these yet, I've only gone and looked in the files under /back-end)

These come from the lines request.write(). For example, in back_end/user.py:
screen shot 2017-01-22 at 4 01 47 pm

I quite like the idea of live error messages that display right when you make the mistake, hehe.

For example, I had changed it so that error messages appear live for the signup page, but that was adding onto @jackfrench's code using jQuery for validation of signup details 😃 I just found out that using JavaScript it's possible to change the text in the elements with class=error

I'm not sure how to take into consideration things from the database though — for example, to display an error message saying that a username is already taken on the sign up page, we need to check in the database.

And then if we wanted to make it a live error message (personal taste hehe), we'd need to be able to change the content on the HTML page, and I think there would be a way to do that...? but I am not sure hmm. Maybe sounds like using template language can do that? I'll have to look around for using the template language 🙂 (haven't gotten to see it in action much actually 😛)

EDIT:

Places where we could add an error message:

  • When you go to the url of a post id that doesn't exist (for example /view/10000 won't exist unless you create 10,000 posts), it should redirect to /404. That would require checking the largest post_id in the db though before redirecting

(e.g. if the largest post_id is only 10, there won't be more than 10 posts. So if someone tries to go to `/view/10000` it should take them to `/404` instead)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions