优化后端代码质量基础
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { runtimeConfig } from '../../config/runtime.js'
|
||||
import { createClaimToken } from '../../repositories/claim-token-repo.js'
|
||||
import { createHttpError } from '../../utils/http.js'
|
||||
import { addHours, nowIso } from '../../utils/time.js'
|
||||
import { randomToken } from '../../utils/random.js'
|
||||
|
||||
@@ -23,7 +24,10 @@ export async function createTaskClaimToken(taskId: number | string): Promise<Tas
|
||||
})
|
||||
|
||||
if (!token) {
|
||||
throw new Error('领取 token 创建失败')
|
||||
throw createHttpError('领取 token 创建失败', {
|
||||
statusCode: 500,
|
||||
errorCode: 'claim_token_create_failed',
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user