SettingsController: fixed wrong error handling when line not found
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user