KinglyEndeavors
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
Looking over the documentation more closely, it does appear to throw an error.
Thank you for all your help, nevertheless!
I appear to be good now, so again, thank you! 🙂
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
Would it throw an error or will it just return nil?
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
@Olyno Last question: Do I need to confirm the existence of the FacilityWorker entity/record as well before attempting to update it? Or is that handled under the hood?
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
Oh, wait. I see. It was released with
4.7.0
and this project is still using ^4.4.0
.16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
It seems to require an array of promises and not just a single promise.
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
@Olyno Is there a reason for it to be returning an array?
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
Gotcha. Thanks. 🙂
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
I guess the part I'm lost on is the fact that the first two first are both read operations that don't update anything that would both throw an error, terminating the flow of operations before reading the actual write operations.
Do the read/select queries effect the database in anyway that I'm not considering?
Or is it more of a just-in-case anything goes wrong with the actual update/write operation itself?
16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
.
Also, I understand what
$transaction
does and what it is for, but why is it necessary within your code sample?
Wouldn't the first two checks render that transaction check unneeded? I thought it was just for use cases where you need to upsert multiple models/entities.
This isn't me questioning you. This is just me as a Prisma-noob who's seeking to better understand the $transaction
feature in this particular use case.16 replies
PPrisma
•Created by KinglyEndeavors on 7/3/2024 in #help-and-questions
Best Practices for Error Handling When Updating Bridge Table (Composite IDs)
Thanks! I figured that may have been the case. but I wasn't 100%.
I'm brand new to Prisma (and ORMs in general), and a part of me was thinking that Prisma would already have something like that built in or something.
That's not a knock against Prisma or anything; I'm assuming it's just something under-the-hood I'm not aware of.
16 replies