Laravel.io
public function show($id)
    {
        try {
            return new userResource(User::findOrFail($id));
        }catch (\Exception $e) {
            return response()->json([$e->getMessage()]);
        }
    }

Please note that all pasted data is publicly available.