Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

map error message+Diesel server status 500 #758

Open
4ydan opened this issue Jul 31, 2023 · 7 comments · May be fixed by #1298
Open

map error message+Diesel server status 500 #758

4ydan opened this issue Jul 31, 2023 · 7 comments · May be fixed by #1298
Assignees
Labels
backend changes in Rust code

Comments

@4ydan
Copy link
Contributor

4ydan commented Jul 31, 2023

Describe the Bug

When creating a map with a name that already exists the server responds with 500.

Steps to Reproduce the Problem

  • open website
  • create two maps with the same name

Expected Result

409 Conflict

Actual Result

500

PermaplanT version

0.3.0

Operating System

Windows 10

Browser

Opera

Versions of other relevant software/extensions

No response

Additional info/logs

image

@4ydan 4ydan added backend changes in Rust code low priority labels Jul 31, 2023
@markus2330
Copy link
Contributor

Thank you for reporting this problem!

@badnames
Copy link
Member

badnames commented Aug 2, 2023

Just FYI if you look at the server response it should say what exactly went wrong.
It might be useful to include this information into this bug report.

@4ydan
Copy link
Contributor Author

4ydan commented Aug 2, 2023

Yes thank you. The message is fine duplicate key value violates unique constraint "map_unique_name", its just that the error code is not appropriate.

@markus2330 markus2330 changed the title Diesel server status 500 map error message+Diesel server status 500 Aug 8, 2023
@markus2330
Copy link
Contributor

The user-facing error message is also not ideal. There should be a different status code for duplicated maps, so that we can be sure. (And don't need to say "maybe" it is a duplicated map).

A better solution would be to directly validate the map name while typing, though.

@markus2330
Copy link
Contributor

@tschawax do we need an extra endpoint to check for duplicate map names or can we have better usability by simply having a different return code for duplicate map names?

@tschawax
Copy link
Contributor

tschawax commented Sep 3, 2023

I would go with the 409 Conflict code which is one of the mainly used ones for such "something already exists" scenarios.
And I agree that the server response should explain what's wrong.
And I also agree that we should remove the maybe and change the error/info message in the frontend to sth like Tut mir leid, eine Karte mit diesem Namen existiert bereits.

@markus2330
Copy link
Contributor

Ok, 409 Conflict sounds reasonable, I updated the top-post.

error/info message

I would prefer if the user would not get a toast but see a message directly at the problematic field, ideally while typing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend changes in Rust code
Projects
Status: In Review
Development

Successfully merging a pull request may close this issue.

5 participants