如果闲的蛋疼的话可以试试
http://fsprojects.github.io/Fable/最后结果类似这样
```F#
async {
try
let! exists = users.userExists({username: username})
if exists:
res.status(HttpStatus.CONFLICT).json(response);
return;
try:
let! users.emailExists(profile.email)
if exists:
response.error = '邮箱 ' + profile.email + ' 已存在';
res.status(HttpStatus.CONFLICT).json(response);
return
try:
let! (uid, hash) = users.createUser(username, password, profile)
response.statusMessage = '成功生成用户';
response.uid = uid;
res.json(response);
except err:
response.error = '生成用户错误';
console.error('Failed to create user ' + err);
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(response);
except err:
console.error('checking email error');
response.error = '业务忙,请稍候重试';
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(response);
except err:
console.error('Error testing if user exists: ' + err);
response.error = '业务忙,请稍候重试'
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(response);
finally:
users.close()
}
```