From 708a5aeb09f055ff25aec599bfa54e2e4997cf94 Mon Sep 17 00:00:00 2001 From: Dennis Mwea Date: Sun, 4 Oct 2020 00:10:39 +0300 Subject: [PATCH] Check whether file exists and give a more descriptive message --- src/Exceptions/FileNotFoundException.php | 13 +++++++++++++ src/Http/Controller.php | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 src/Exceptions/FileNotFoundException.php diff --git a/src/Exceptions/FileNotFoundException.php b/src/Exceptions/FileNotFoundException.php new file mode 100644 index 00000000..3cbc7c1e --- /dev/null +++ b/src/Exceptions/FileNotFoundException.php @@ -0,0 +1,13 @@ +has('apidoc/collection.json')) { + throw new FileNotFoundException(400, 'Please run php artisan apidoc:generate.'); + } + return response()->json( json_decode(Storage::disk(config('apidoc.storage'))->get('apidoc/collection.json')) );