Remove unnecessary try|catch

This commit is contained in:
Bubka 2020-01-26 21:49:39 +01:00
parent 5531c0e7e1
commit c6b7c4e495

View File

@ -58,12 +58,9 @@ public function store(Request $request)
*/
public function show($id)
{
try {
$twofaccount = TwoFAccount::FindOrFail($id);
return response()->json($twofaccount, 200);
} catch (\Exception $e) {
return response()->json( ['message' => 'not found' ], 404);
}
}
@ -95,8 +92,6 @@ public function update(Request $request, $id)
'service' => 'required',
]);
try {
$twofaccount = TwoFAccount::FindOrFail($id);
if( $twofaccount->type === 'hotp' ) {
@ -129,12 +124,6 @@ public function update(Request $request, $id)
return response()->json($twofaccount, 200);
}
catch (\Exception $e) {
return response()->json( ['message' => 'not found' ] , 404);
}
}
/**
@ -145,7 +134,6 @@ public function update(Request $request, $id)
*/
public function destroy($id)
{
try {
$twofaccount = TwoFAccount::FindOrFail($id);
@ -156,16 +144,10 @@ public function destroy($id)
Storage::delete($storedIcon);
}
// delete account
$twofaccount->delete();
return response()->json(null, 204);
}
catch (\Exception $e) {
return response()->json(['message' => 'already gone'], 404);
}
}
}