async () => {
let transaction = await env.site.database.Transaction()
try {
- let account = await get_account(
- env,
- transaction,
- await get_session(env, transaction)
- )
+ let root = await transaction.get({})
+ let session = await get_session(env, root)
+
+ let account = await get_account(root, session)
if (account === undefined)
throw new Problem('Unauthorized', 'Please sign in first.', 401)
-
if (!await account.get_json('administrator'))
throw new Problem('Unauthorized', 'Not administrator.', 401)
- nodemailer = await (
- await transaction.get({})
- ).get_json('nodemailer', {})
-
- await transaction.commit()
- return nodemailer
+ return /*await*/ root.get_json('nodemailer', {})
}
- catch (error) {
+ finally {
transaction.rollback()
- throw error
}
}
)