Grokking Agentic Design Patterns
Vote

0% completed

​

Exception Handling and Recovery

The order lookup below tries three times before it gives up, and at first sight it looks careful:

function lookUpOrder(orderId) { for (let attempt = 1; attempt <= 3; attempt++) { try { return orders.get(orderId) } catch (err) { // Try again at once } } throw new Error("Order lookup failed") }

It has four defects. First, it tries again at once, so an overloaded system receives three calls in the same second. It retries every error, including an order number that does not exist, which no retry can repair

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content