SettingsController: fixed wrong error handling when line not found

This commit is contained in:
Sockenklaus
2021-11-14 16:23:46 +01:00
parent 2fcdc59677
commit 665bf6b22f

View File

@@ -22,19 +22,13 @@ export default class SettingsController {
}
public async get({params, auth}: HttpContextContract): Promise<ResultSetting | null> {
public async get({params, auth, response}: HttpContextContract): Promise<ResultSetting | null> {
const key = params.key
try {
const result = auth.user.related('settings').query().select(['key', 'value']).where('key', key).first()
return result
}
catch(error) {
return error
}
const result = await auth.user.related('settings').query().select(['key', 'value']).where('key', key).firstOrFail()
return result
}
/**