Skip to content

Commit

Permalink
Merge pull request #414 from bugsnag/release/v2.20.1
Browse files Browse the repository at this point in the history
Release v2.20.1
  • Loading branch information
imjoehaines authored Oct 13, 2020
2 parents 66d23a6 + 0199206 commit fe049f5
Show file tree
Hide file tree
Showing 23 changed files with 604 additions and 26 deletions.
22 changes: 22 additions & 0 deletions .ci/patches/Dockerfile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ecc7d44
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,16 @@
+FROM php:latest
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ git \
+ unzip \
+ wget \
+ zip
+
+WORKDIR /app
+
+COPY . .
+
+RUN php artisan key:generate
+
+CMD php -S 0.0.0.0:8000 server.php
20 changes: 20 additions & 0 deletions .ci/patches/logging.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/config/logging.php b/config/logging.php
index 088c204..107a3c7 100644
--- a/config/logging.php
+++ b/config/logging.php
@@ -37,10 +37,14 @@ return [
'channels' => [
'stack' => [
'driver' => 'stack',
- 'channels' => ['single'],
+ 'channels' => ['single', 'bugsnag'],
'ignore_exceptions' => false,
],

+ 'bugsnag' => [
+ 'driver' => 'bugsnag'
+ ],
+
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
98 changes: 98 additions & 0 deletions .ci/patches/middleware.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php
index 36ced13..71cc168 100644
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@ -62,5 +62,9 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
+ 'unMidEx' => \App\Http\Middleware\UnhandledMiddlewareEx::class,
+ 'unMidErr' => \App\Http\Middleware\UnhandledMiddlewareErr::class,
+ 'hanMidEx' => \App\Http\Middleware\HandledMiddlewareEx::class,
+ 'hanMidErr' => \App\Http\Middleware\HandledMiddlewareErr::class,
];
}
diff --git a/app/Http/Middleware/HandledMiddlewareErr.php b/app/Http/Middleware/HandledMiddlewareErr.php
new file mode 100644
index 0000000..f10e6d5
--- /dev/null
+++ b/app/Http/Middleware/HandledMiddlewareErr.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Bugsnag\BugsnagLaravel\Facades\Bugsnag;
+use Closure;
+
+class HandledMiddlewareErr
+{
+ public function handle($request, Closure $next)
+ {
+ Bugsnag::notifyError('Handled middleware error', 'This is a handled error');
+ return $next($request);
+ }
+}
diff --git a/app/Http/Middleware/HandledMiddlewareEx.php b/app/Http/Middleware/HandledMiddlewareEx.php
new file mode 100644
index 0000000..9456ce8
--- /dev/null
+++ b/app/Http/Middleware/HandledMiddlewareEx.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Bugsnag\BugsnagLaravel\Facades\Bugsnag;
+use Closure;
+use Exception;
+
+class HandledMiddlewareEx
+{
+ public function handle($request, Closure $next)
+ {
+ Bugsnag::notifyException(new Exception('Handled middleware exception'));
+ return $next($request);
+ }
+}
diff --git a/app/Http/Middleware/UnhandledMiddlewareErr.php b/app/Http/Middleware/UnhandledMiddlewareErr.php
new file mode 100644
index 0000000..f28d7e8
--- /dev/null
+++ b/app/Http/Middleware/UnhandledMiddlewareErr.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+
+class UnhandledMiddlewareErr
+{
+ public function handle($request, Closure $next)
+ {
+ foo();
+ return $next($request);
+ }
+}
diff --git a/app/Http/Middleware/UnhandledMiddlewareEx.php b/app/Http/Middleware/UnhandledMiddlewareEx.php
new file mode 100644
index 0000000..3559022
--- /dev/null
+++ b/app/Http/Middleware/UnhandledMiddlewareEx.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+use Exception;
+
+class UnhandledMiddlewareEx
+{
+ public function handle($request, Closure $next)
+ {
+ throw new Exception('Unhandled middleware exception');
+ return $next($request);
+ }
+}
21 changes: 21 additions & 0 deletions .ci/patches/register-service-provider-and-facade.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/config/app.php b/config/app.php
index 8409e00..3592882 100644
--- a/config/app.php
+++ b/config/app.php
@@ -165,6 +165,7 @@ return [
/*
* Package Service Providers...
*/
+ Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class,

/*
* Application Service Providers...
@@ -227,6 +228,8 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,

+ 'Bugsnag' => Bugsnag\BugsnagLaravel\Facades\Bugsnag::class,
+
],

];
39 changes: 39 additions & 0 deletions .ci/patches/test-controller.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/app/Http/Controllers/TestController.php b/app/Http/Controllers/TestController.php
new file mode 100644
index 0000000..35978b7
--- /dev/null
+++ b/app/Http/Controllers/TestController.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Bugsnag\BugsnagLaravel\Facades\Bugsnag;
+use Exception;
+
+class TestController extends Controller
+{
+ public function unhandledException()
+ {
+ throw new Exception('Crashing exception!');
+ }
+
+ public function unhandledError()
+ {
+ foo();
+ }
+
+ public function handledException()
+ {
+ Bugsnag::notifyException(new Exception('Handled exception'));
+
+ return 'done';
+ }
+
+ public function handledError()
+ {
+ Bugsnag::notifyError('Handled error', 'This is a handled error');
+
+ return 'done';
+ }
+}
72 changes: 72 additions & 0 deletions .ci/patches/views.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
diff --git a/resources/views/handlederror.blade.php b/resources/views/handlederror.blade.php
new file mode 100644
index 0000000..093b53f
--- /dev/null
+++ b/resources/views/handlederror.blade.php
@@ -0,0 +1,12 @@
+<!doctype html>
+<html lang="{{ app()->getLocale() }}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Laravel</title>
+ </head>
+ <body>
+ <?php app('bugsnag')->notifyError("Handled error", "This is a handled error") ?>
+ </body>
+</html>
diff --git a/resources/views/handledexception.blade.php b/resources/views/handledexception.blade.php
new file mode 100644
index 0000000..7de6e66
--- /dev/null
+++ b/resources/views/handledexception.blade.php
@@ -0,0 +1,12 @@
+<!doctype html>
+<html lang="{{ app()->getLocale() }}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Laravel</title>
+ </head>
+ <body>
+ <?php app('bugsnag')->notifyException(new Exception("Handled view exception")) ?>
+ </body>
+</html>
diff --git a/resources/views/unhandlederror.blade.php b/resources/views/unhandlederror.blade.php
new file mode 100644
index 0000000..91bf125
--- /dev/null
+++ b/resources/views/unhandlederror.blade.php
@@ -0,0 +1,12 @@
+<!doctype html>
+<html lang="{{ app()->getLocale() }}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Laravel</title>
+ </head>
+ <body>
+ <?php foo() ?>
+ </body>
+</html>
diff --git a/resources/views/unhandledexception.blade.php b/resources/views/unhandledexception.blade.php
new file mode 100644
index 0000000..c0ee78f
--- /dev/null
+++ b/resources/views/unhandledexception.blade.php
@@ -0,0 +1,12 @@
+<!doctype html>
+<html lang="{{ app()->getLocale() }}">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Laravel</title>
+ </head>
+ <body>
+ <?php throw new Exception("Unhandled exception") ?>
+ </body>
+</html>
50 changes: 50 additions & 0 deletions .ci/patches/web-routes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff --git a/routes/web.php b/routes/web.php
index b130397..4b89d73 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -1,5 +1,6 @@
<?php

+use App\Http\Controllers\TestController;
use Illuminate\Support\Facades\Route;

/*
@@ -16,3 +17,38 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('welcome');
});
+
+Route::get('/unhandled_exception', function () {
+ throw new Exception('Crashing exception!');
+});
+
+Route::get('/unhandled_error', function () {
+ call_foo();
+});
+
+Route::get('/handled_exception', function () {
+ Bugsnag::notifyException(new Exception('Handled exception!'));
+});
+
+Route::get('/handled_error', function () {
+ Bugsnag::notifyError('Handled Error', 'This is a handled error');
+});
+
+Route::get('/unhandled_controller_exception', [TestController::class, 'unhandledException']);
+Route::get('/unhandled_controller_error', [TestController::class, 'unhandledError']);
+Route::get('/handled_controller_exception', [TestController::class, 'handledException']);
+Route::get('/handled_controller_error', [TestController::class, 'handledError']);
+
+Route::get('/unhandled_middleware_exception', function () {
+})->middleware('unMidEx');
+Route::get('/unhandled_middleware_error', function () {
+})->middleware('unMidErr');
+Route::get('/handled_middleware_exception', function () {
+})->middleware('hanMidEx');
+Route::get('/handled_middleware_error', function () {
+})->middleware('hanMidErr');
+
+Route::view('/unhandled_view_exception', 'unhandledexception');
+Route::view('/unhandled_view_error', 'unhandlederror');
+Route::view('/handled_view_exception', 'handledexception');
+Route::view('/handled_view_error', 'handlederror');
28 changes: 28 additions & 0 deletions .ci/setup-laravel-dev-fixture.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env sh

set -e

cd features/fixtures

rm -rf laravel-latest

# Ignore dev dependencies because we don't need them to run the Maze Runner tests
# and they will only introduce more failure points
composer create-project laravel/laravel laravel-latest --no-dev

cd laravel-latest

composer require 'laravel/framework:dev-master as 8' --update-with-dependencies --no-update
composer require bugsnag/bugsnag-laravel --no-update

composer update --no-dev

printf "\nCreated Laravel project using these versions:\n"

composer show --direct

printf "\nApplying patches...\n"

for patch in ../../../.ci/patches/*.patch; do
patch -p1 < "$patch"
done
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
/example export-ignore
/features export-ignore
/tests export-ignore
/.ci export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/CONTRIBUTING.md export-ignore
/CHANGELOG.md export-ignore
/README.md export-ignore
/Makefile export-ignore
/phpunit.xml.dist export-ignore
/.github export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
Gemfile.lock
maze_output
.phpunit.result.cache
/features/fixtures/laravel-latest/*
!/features/fixtures/laravel-latest/.gitignore
Loading

0 comments on commit fe049f5

Please sign in to comment.