- Replace manual Repo.rollback/1 calls with raise/return patterns - Fix typo: Repo.transact -> Repo.transaction - Add unwrap_transaction_result/1 helper to reduce nesting depth - Extract helper functions to satisfy Credo nesting depth requirements - Fixes 'operation :rollback is rolling back unexpectedly' error When Oban Pro's Smart engine uses Ecto.Multi for nested transactions, manual Repo.rollback/1 calls break the transaction stack. This fix uses proper error handling patterns: 1. Raise exceptions to trigger automatic rollback (admin.ex) 2. Return error tuples and unwrap with helper function (accounts.ex, mobile_sessions.ex) Files changed: - lib/towerops/admin.ex (3 functions: delete_user, delete_organization, update_billing_overrides) - lib/towerops/accounts.ex (5 functions with helpers: update_user_email, reset_user_password, update_user_and_delete_all_tokens, do_update_user_and_delete_tokens, delete_account) - lib/towerops/mobile_sessions.ex (2 functions with helper: complete_qr_login, do_complete_qr_login) All tests passing (277 tests total). Reviewed-on: graham/towerops-web#201 |
||
|---|---|---|
| .. | ||
| mix/tasks | ||
| snmpkit | ||
| towerops | ||
| towerops_web | ||
| snmp_lib.ex | ||
| snmp_mgr.ex | ||
| snmpkit.ex | ||
| towerops.ex | ||
| towerops_native.ex | ||
| towerops_web.ex | ||