(logger: Logger, payload: { accountId: string })
| 14 | }; |
| 15 | |
| 16 | async function task(logger: Logger, payload: { accountId: string }) { |
| 17 | logger.info(payload); |
| 18 | |
| 19 | const account = await AccountsService.getMoreInfo(payload.accountId); |
| 20 | const moreInfo = JSON.stringify(account); |
| 21 | |
| 22 | await sendNotification( |
| 23 | `[INFO] Remove account ${payload.accountId} process started: ${moreInfo}` |
| 24 | ); |
| 25 | try { |
| 26 | await cleanUp({ accountId: payload.accountId, logger }); |
| 27 | await sendNotification( |
| 28 | `[INFO] Remove account ${payload.accountId} process finished: ${moreInfo}` |
| 29 | ); |
| 30 | } catch (error) { |
| 31 | await sendNotification( |
| 32 | `[ERROR] Remove account ${payload.accountId} process failed: ${moreInfo}` |
| 33 | ); |
| 34 | logger.error({ error }); |
| 35 | throw error; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | async function cleanUp({ |
| 40 | accountId, |
no test coverage detected