Exercise 2: Why try/catch Instead of an if Check — Possible Solution ==================================================================== WHAT P2025 ACTUALLY MEANS ------------------------------ P2025 is Prisma's own error code for "the operation tried to act on a record that doesn't exist" - specifically here, "Record to update not found." It's thrown by update() (and similarly by delete(), findUniqueOrThrow(), and findFirstOrThrow()) whenever the where clause, including any extended non-unique conditions, doesn't match any row. WHY THIS ROUTE NEEDS try/catch RATHER THAN AN if CHECK ------------------------------ The sibling course's raw SQL UPDATE always completes without error, whether or not any row actually matched the WHERE clause - the only signal is the result.changes count, a plain returned value the route checks with a normal if statement. Prisma's update() behaves differently: when the where clause (including the status: "active" condition) doesn't match a row, it doesn't return a result to check at all - it throws a real exception. The only way to catch that and turn it into a clean 404 response, rather than letting it become an unhandled error, is to wrap the call in try/catch and check the thrown error's own code property for "P2025". WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains what P2025 represents, and it correctly connects the different failure mechanism (a returned value vs. a thrown exception) to why the route's own error-handling shape has to be structurally different between the two courses, even though the underlying guard condition is doing the same job in both.