Fix: Creating a teacher, if course sent not exists, response is PrismaClientKnownRequestError
Closed this issue · 0 comments
dacmarcell commented
How to reproduce?
With database sync, create a teacher with a course name which does not exists
Example:
{
"name":"professora",
"email":"professora@email.com",
"password":"12345678",
"isCoordinator":false,
"courseName":"Data Structures"
}
Response:
{
"message": {
"name": "PrismaClientKnownRequestError",
"code": "P2018",
"clientVersion": "5.10.2",
"meta": {
"modelName": "Teacher",
"details": "Expected 1 records to be connected after connect operation on one-to-many relation 'CoursesToTeacher', found 0."
}
},
"error": true
}
Create a error handling for this