▸case-01 I'm refactoring an Express.js user registration endpoint where our controller currently catches database errors and sends the raw SQL message back to the client, while validation failures return internal server errors. Additionally, some async calls have empty catch blocks that ignore failures. Can you review and refactor this service method and controller to follow proper error handling architecture across layers? | fail→pass | 24,734 | 26,519 | +7% | 1 | 1 | 0% | 3,582 | 4,466 | +25% | 0 | 0 | — |
▸case-02 Here is my Go checkout handler and domain service code. Right now, my domain layer imports `net/http` to set status codes, and our API responses occasionally dump full stack traces when third-party API calls fail. Please refactor this snippet to clean up layer separation, wrap errors properly, and standardize our error response format. | fail→fail | 18,536 | 21,278 | +15% | 1 | 1 | 0% | 3,460 | 3,371 | -3% | 0 | 0 | — |
▸case-03 Our team is updating our backend error management standards for an order processing service. We need a standardized API error response structure and proper error code conventions, but we want to ensure database credentials or raw driver errors aren't leaked to clients when queries fail. Please write a TypeScript example showing how to handle errors across the controller, domain, and database layers. | fail→pass | 30,957 | 21,599 | -30% | 1 | 1 | 0% | 4,681 | 4,156 | -11% | 0 | 0 | — |
▸case-04 We are optimizing read latency for our PostgreSQL orders table, which currently suffers from slow full table scans on queries filtering by customer_id and created_at. Please provide a migration script and indexing strategy for this query pattern. | pass→pass | 18,997 | 18,980 | -0% | 1 | 1 | 0% | 2,191 | 2,505 | +14% | 0 | 0 | — |
▸case-05 Our backend team is implementing RSA public/private key rotation for signing JSON Web Tokens across our API auth gateway. How should we handle key rollover and JWKS endpoint caching without downtime? | pass→pass | 24,068 | 28,054 | +17% | 1 | 1 | 0% | 2,970 | 3,985 | +34% | 0 | 0 | — |
▸case-06 We want to configure Prometheus instrumentation for monitoring request duration percentiles in our Go HTTP server. How should we define metric collectors to track latency distribution? | pass→pass | 20,907 | 18,610 | -11% | 1 | 1 | 0% | 2,600 | 2,621 | +1% | 0 | 0 | — |
▸case-07 We are implementing a subscription discount calculation service in TypeScript. Developers often define custom error classes in the domain layer containing `statusCode: 422` or `statusCode: 400` so controllers can rethrow them directly. Please write the domain service and custom domain error class for invalid discount codes, showing how errors should be structured and thrown. | fail→pass | 21,631 | 18,588 | -14% | 1 | 1 | 0% | 3,108 | 2,969 | -4% | 0 | 0 | — |
▸case-08 In our Node.js user repository, raw PostgreSQL errors like `PQconnectDevice: FATAL: password authentication failed for user postgres` or `column orders.price does not exist` are being caught in the API controller and returned directly to the mobile app client. Refactor the repository layer method to handle database driver failures appropriately. | pass→pass | 24,632 | 12,963 | -47% | 1 | 1 | 0% | 3,670 | 2,748 | -25% | 0 | 0 | — |
▸case-09 We are designing the error response schema for an inventory service API. Developers are debating whether error codes should be camelCase like `itemOutOfStock` or kebab-case like `item-out-of-stock` or numeric error codes like `1004`. Provide a sample JSON error response body for a missing inventory item. | fail→pass | 21,393 | 7,854 | -63% | 1 | 1 | 0% | 2,206 | 1,505 | -32% | 0 | 0 | — |
▸case-10 During code review of our payment processor webhook listener in Node.js, we found several instances where developers wrote `try { await notifyWebhook(event); } catch (e) {}` because webhook notifications are non-critical. How should this code snippet be refactored? | pass→pass | 19,973 | 14,649 | -27% | 1 | 1 | 0% | 2,394 | 1,921 | -20% | 0 | 0 | — |
▸case-11 We are writing a Go data access method `FindUserByID(id string) (*User, error)` that calls a SQL driver query. When `db.QueryRow` returns an error, junior developers currently write `return nil, err` or `return nil, fmt.Errorf("user query failed: %v", err)`. Show how to properly handle and return this error from the repository method. | pass→pass | 18,076 | 16,069 | -11% | 1 | 1 | 0% | 2,306 | 2,184 | -5% | 0 | 0 | — |
▸case-12 In our Node.js microservice, a third-party shipping API integration catches fetch errors and throws `new Error('Shipping request failed')`, losing the original network error stack and response status. How should we update this error throw in modern JavaScript? | pass→pass | 18,042 | 16,143 | -11% | 1 | 1 | 0% | 2,096 | 2,331 | +11% | 0 | 0 | — |
▸case-13 Our REST API controller processes user profile update forms. When request payload validation fails due to an invalid email format or missing required age field, our global error handler defaults to HTTP status code 500 Internal Server Error. Refactor the controller and error handler for validation failures. | pass→pass | 16,637 | 20,789 | +25% | 1 | 1 | 0% | 3,112 | 3,621 | +16% | 0 | 0 | — |
▸case-14 When an unexpected runtime exception occurs in our production Express backend, the response JSON includes `"stack": "Error: connect ECONNREFUSED at TCPConnectWrap.afterConnect..."`. Show how the API response payload should be structured for unhandled failures in production. | pass→pass | 17,440 | 12,188 | -30% | 1 | 1 | 0% | 2,104 | 1,589 | -24% | 0 | 0 | — |
▸case-15 Our database connection helper catches authentication failures containing raw connection strings like `postgres://admin:SecretPass123@db.internal:5432/main`. When an error occurs, should we wrap this error with `fmt.Errorf("db error: %w", err)` or replace it? | pass→pass | 11,957 | 7,288 | -39% | 1 | 1 | 0% | 1,989 | 1,423 | -28% | 0 | 0 | — |
▸case-16 Our backend team wants every API endpoint controller to manually map domain business errors to HTTP status codes with individual `if (err instanceof UserNotFoundError) res.status(404)...` blocks. Show how to structure error mapping centrally across the application. | pass→pass | 24,494 | 17,885 | -27% | 1 | 1 | 0% | 3,228 | 2,560 | -21% | 0 | 0 | — |
▸case-17 In a Python FastAPI service, our external payment client catches `requests.RequestException` and raises a custom `PaymentGatewayError`. How should the custom exception be raised to maintain context without leaking lower-level request object details? | pass→pass | 21,975 | 18,935 | -14% | 1 | 1 | 0% | 2,864 | 2,556 | -11% | 0 | 0 | — |
▸case-18 In a Go background job processor, a developer wrote `_ = logService.SendAuditLog(ctx, event)` to ignore failure when writing audit logs. Show how this statement should be refactored to avoid silently ignoring errors. | pass→pass | 16,376 | 7,568 | -54% | 1 | 1 | 0% | 1,791 | 1,478 | -17% | 0 | 0 | — |
▸case-19 We are designing the standard error payload for our company's public REST APIs. Some teams return `{ "error": "User not found" }` while others return `{ "message": "Failed", "code": 4041 }`. Provide a standardized JSON error envelope format for API error responses. | pass→pass | 21,620 | 12,579 | -42% | 1 | 1 | 0% | 2,880 | 2,343 | -19% | 0 | 0 | — |
▸case-20 In a Go order management domain package `domain/order`, a function `CancelOrder(order *Order)` currently checks if the order is already shipped and returns `echo.NewHTTPError(http.StatusConflict, "cannot cancel shipped order")`. Refactor this domain code. | pass→pass | 12,809 | 15,753 | +23% | 1 | 1 | 0% | 2,191 | 2,201 | +0% | 0 | 0 | — |
▸case-21 In our NestJS microservice, the user cache repository queries Redis directly. When Redis is down, `ReplyError: REDIS_NODE_OFFLINE` propagates straight through the domain service to the controller. How should the infrastructure repository layer handle this Redis exception? | pass→pass | 22,428 | 13,758 | -39% | 1 | 1 | 0% | 2,901 | 2,585 | -11% | 0 | 0 | — |
▸case-22 An API gateway receives two types of failures: a malformed JSON payload with missing required schema fields, and an unhandled null reference crash during business calculation. Explain what HTTP status codes should be returned for each case. | pass→pass | 12,039 | 12,101 | +1% | 1 | 1 | 0% | 2,069 | 1,496 | -28% | 0 | 0 | — |