Skip to content

Commit 8216f8e

Browse files
authored
Merge pull request #77 from bowphp/5.x-ref-update
[5.x] Structure formating
2 parents a1399f3 + 3a11aa5 commit 8216f8e

8 files changed

Lines changed: 3 additions & 58 deletions

File tree

app/Configurations/ApplicationConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ApplicationConfiguration extends Configuration
1515
*/
1616
public function create(Loader $config): void
1717
{
18-
// Event::on("user.created", UserCreatedListener::class);
18+
//
1919
}
2020

2121
/**

app/Exceptions/ErrorHandle.php

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
namespace App\Exceptions;
44

55
use Exception;
6-
use PDOException;
76
use Bow\Http\Exception\HttpException;
8-
use Policier\Exception\TokenExpiredException;
9-
use Policier\Exception\TokenInvalidException;
107
use Bow\Application\Exception\BaseErrorHandler;
118
use Bow\Http\Exception\ResponseException as HttpResponseException;
129
use Bow\Database\Exception\NotFoundException as ModelNotFoundException;
@@ -42,56 +39,4 @@ public function handle($exception): mixed
4239
]);
4340
}
4441
}
45-
46-
/**
47-
* Send the json as response
48-
*
49-
* @param string $data
50-
* @param mixed $code
51-
* @return mixed
52-
*/
53-
private function json($exception, $code = null)
54-
{
55-
if ($exception instanceof TokenInvalidException) {
56-
$code = 'TOKEN_INVALID';
57-
}
58-
59-
if ($exception instanceof TokenExpiredException) {
60-
$code = 'TOKEN_EXPIRED';
61-
}
62-
63-
if (is_null($code)) {
64-
if (method_exists($exception, 'getStatus')) {
65-
$code = $exception->getStatus();
66-
} else {
67-
$code = 'INTERNAL_SERVER_ERROR';
68-
}
69-
}
70-
71-
if (app_env("APP_ENV") == "production" && $exception instanceof PDOException) {
72-
$message = 'Internal error occured';
73-
} else {
74-
$message = $exception->getMessage();
75-
}
76-
77-
$error = [
78-
'message' => $message,
79-
'code' => $code,
80-
'time' => date('Y-m-d H:i:s')
81-
];
82-
83-
if (config('app.error_trace')) {
84-
$trace = $exception->getTrace();
85-
} else {
86-
$trace = [];
87-
}
88-
89-
if ($exception instanceof HttpException) {
90-
$status = $exception->getStatusCode();
91-
} else {
92-
$status = 500;
93-
}
94-
95-
return json(compact('error', 'trace'), $status);
96-
}
9742
}

app/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function namespaces(): array
4242
}
4343

4444
/**
45-
* Define the app middlewares
45+
* Define the app middleware
4646
*
4747
* @return array
4848
*/

config/translate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
/**
1616
* Path to the language repeater
1717
*/
18-
'dictionary' => __DIR__ . '/../frontend/lang',
18+
'dictionary' => __DIR__ . '/../lang',
1919
];

0 commit comments

Comments
 (0)