-
Notifications
You must be signed in to change notification settings - Fork 45
Modify 500 code error response page #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's rename file to error.blade.php
, need to unlink logic from the swagger usage only
@@ -30,7 +30,7 @@ public function saveData(): void | |||
public function getDocumentation(): array | |||
{ | |||
if (!file_exists($this->prodFilePath)) { | |||
throw new FileNotFoundException(); | |||
throw new FileNotFoundException("Documentation file not found :{$this->prodFilePath}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move error message to the exception and just pass the path as arg
throw new FileNotFoundException("Documentation file not found :{$this->prodFilePath}"); | |
throw new FileNotFoundException($this->prodFilePath); |
@@ -138,7 +138,21 @@ protected function generateEmptyData(): array | |||
throw new EmptyContactEmailException(); | |||
} | |||
|
|||
$data = [ | |||
$data = $this->generateBaseDataObject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we need to make this change, could you please revert it?
$documentation = $this->driver->getDocumentation(); | ||
|
||
$this->openAPIValidator->validate($documentation); | ||
} catch (\Exception $exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} catch (\Exception $exception) { | |
} catch (Exception $exception) { |
|
||
$this->openAPIValidator->validate($documentation); | ||
$this->config['info'] = Arr::set($this->config, 'info.description', Arr::get($this->config, 'defaults.error')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's pass the description view as arg, it would be better to redefine the config field
app(SwaggerService::class)->getDocFileContent(); | ||
$description = Arr::get($content, 'info.description'); | ||
|
||
$this->assertEquals($exceptionMessage, Str::replace(''', "'", $description)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to assert rendered error view instead of
refs: #163