Skip to content

Commit b311505

Browse files
committed
fixed formatter exception
1 parent 40c1659 commit b311505

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Formatters/JsonFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Mtrajano\LaravelSwagger\Formatters;
44

5+
use Mtrajano\LaravelSwagger\LaravelSwaggerException;
6+
57
class JsonFormatter extends Formatter
68
{
79
public function format()
810
{
911
if (!extension_loaded('json')) {
10-
throw new \Exception('JSON extension must be loaded to use the json output format');
12+
throw new LaravelSwaggerException('JSON extension must be loaded to use the json output format');
1113
}
1214

1315
return json_encode($this->docs, JSON_PRETTY_PRINT);

src/Formatters/YamlFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Mtrajano\LaravelSwagger\Formatters;
44

5+
use Mtrajano\LaravelSwagger\LaravelSwaggerException;
6+
57
class YamlFormatter extends Formatter
68
{
79
public function format()
810
{
911
if (!extension_loaded('yaml')) {
10-
throw new \Exception('YAML extension must be loaded to use the yaml output format');
12+
throw new LaravelSwaggerException('YAML extension must be loaded to use the yaml output format');
1113
}
1214

1315
return yaml_emit($this->docs);

0 commit comments

Comments
 (0)