Commit 22b8f8a
committed
fix: [#223] HTTP error status code trying to insert duplicate category in MySQL
Using MySQL the endpoint to inser categories returns a different HTTP
status code. It should return a 400 and It was returning a 500.
The reason is we parse the error message and for MySQL the error message
is not the same as SQLite:
MySQL:
```
Error: Duplicate entry 'category name 118802' for key 'torrust_categories.name'
```
It has been changed but we should now rely on concrete error messages.
Besides we should not relay on the database contrains, mahybe we should
check in the handler that the category does not exist.1 parent c6346a5 commit 22b8f8a
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| |||
0 commit comments