class WhoopsBookStackPrettyHandler extends Handler
{
-
/**
* @return int|null A handler may return nothing, or a Handler::HANDLE_* constant
*/
$exception = $this->getException();
echo view('errors.debug', [
- 'error' => $exception->getMessage(),
- 'errorClass' => get_class($exception),
- 'trace' => $exception->getTraceAsString(),
+ 'error' => $exception->getMessage(),
+ 'errorClass' => get_class($exception),
+ 'trace' => $exception->getTraceAsString(),
'environment' => $this->getEnvironment(),
])->render();
return Handler::QUIT;
}
- protected function safeReturn(callable $callback, $default = null) {
+ protected function safeReturn(callable $callback, $default = null)
+ {
try {
return $callback();
} catch (\Exception $e) {
protected function getEnvironment(): array
{
return [
- 'PHP Version' => phpversion(),
- 'BookStack Version' => $this->safeReturn(function() {
+ 'PHP Version' => phpversion(),
+ 'BookStack Version' => $this->safeReturn(function () {
$versionFile = base_path('version');
+
return trim(file_get_contents($versionFile));
}, 'unknown'),
- 'Theme Configured' => $this->safeReturn(function() {
- return config('view.theme');
- }) ?? 'None',
+ 'Theme Configured' => $this->safeReturn(function () {
+ return config('view.theme');
+ }) ?? 'None',
];
}
-}
\ No newline at end of file
+}
$resp = $this->get('/mfa/totp/generate');
$resp->assertSeeText('Mobile App Setup');
- $resp->assertDontSee("otpauth://totp/BookStack:guest%40example.com");
- $resp->assertSee("otpauth://totp/BookStack:admin%40admin.com");
+ $resp->assertDontSee('otpauth://totp/BookStack:guest%40example.com');
+ $resp->assertSee('otpauth://totp/BookStack:admin%40admin.com');
}
}
$resp->assertSeeText('An unknown error occurred');
}
-
protected function getDebugViewForException(\Exception $exception): TestResponse
{
// Fake an error via social auth service used on login page
$mockService = $this->mock(SocialAuthService::class);
$mockService->shouldReceive('getActiveDrivers')->andThrow($exception);
+
return $this->get('/login');
}
-
-}
\ No newline at end of file
+}