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
|
const key = params.key
|
||||||
|
|
||||||
try {
|
const result = await auth.user.related('settings').query().select(['key', 'value']).where('key', key).firstOrFail()
|
||||||
const result = auth.user.related('settings').query().select(['key', 'value']).where('key', key).first()
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
|
||||||
catch(error) {
|
|
||||||
return error
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user