質問編集履歴

3

Handler

2018/05/06 12:24

投稿

FigHy
FigHy

スコア19

test CHANGED
File without changes
test CHANGED
@@ -125,3 +125,129 @@
125
125
 
126
126
 
127
127
  ```
128
+
129
+
130
+
131
+ ```Handler.php
132
+
133
+ <?php
134
+
135
+
136
+
137
+ namespace App\Exceptions;
138
+
139
+
140
+
141
+ use Exception;
142
+
143
+ use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
144
+
145
+ use Illuminate\Session\TokenMismatchException;
146
+
147
+ use Illuminate\Validation\ValidationException;
148
+
149
+
150
+
151
+ class Handler extends ExceptionHandler
152
+
153
+ {
154
+
155
+ /**
156
+
157
+ * A list of the exception types that are not reported.
158
+
159
+ *
160
+
161
+ * @var array
162
+
163
+ */
164
+
165
+ protected $dontReport = [
166
+
167
+ //
168
+
169
+ ];
170
+
171
+
172
+
173
+ /**
174
+
175
+ * A list of the inputs that are never flashed for validation exceptions.
176
+
177
+ *
178
+
179
+ * @var array
180
+
181
+ */
182
+
183
+ protected $dontFlash = [
184
+
185
+ 'password',
186
+
187
+ 'password_confirmation',
188
+
189
+ ];
190
+
191
+
192
+
193
+ /**
194
+
195
+ * Report or log an exception.
196
+
197
+ *
198
+
199
+ * @param \Exception $exception
200
+
201
+ * @return void
202
+
203
+ */
204
+
205
+ public function report(Exception $exception)
206
+
207
+ {
208
+
209
+ parent::report($exception);
210
+
211
+ }
212
+
213
+
214
+
215
+ /**
216
+
217
+ * Render an exception into an HTTP response.
218
+
219
+ *
220
+
221
+ * @param \Illuminate\Http\Request $request
222
+
223
+ * @param \Exception $exception
224
+
225
+ * @return \Illuminate\Http\Response
226
+
227
+ */
228
+
229
+ public function render($request, Exception $exception)
230
+
231
+ {
232
+
233
+ if ($exception instanceof TokenMismatchException) {
234
+
235
+ return redirect()->back()->with('message','セッションのタイムアウトとなりました。もう一>度入力してください。');
236
+
237
+ }
238
+
239
+ if (get_class($exception) == "ErrorException" || $exception instanceof ValidationException) {
240
+
241
+ return parent::render($request, $exception);
242
+
243
+ }
244
+
245
+ $status = $exception->getStatusCode();
246
+
247
+ return response()->view("errors.common", ['exception' => $exception], $status, $exception->getHeaders());
248
+
249
+ }
250
+
251
+ }
252
+
253
+ ```

2

laravel.log

2018/05/06 12:24

投稿

FigHy
FigHy

スコア19

test CHANGED
File without changes
test CHANGED
@@ -83,3 +83,45 @@
83
83
 
84
84
 
85
85
  足りない情報あればすぐに記載します、大変申し訳ありませんが、何卒宜しくお願い致します。
86
+
87
+
88
+
89
+
90
+
91
+ Laravel.logファイルのエラー内容
92
+
93
+ ```
94
+
95
+ [2018-05-06 02:04:23] production.ERROR: Uncaught Error: Call to undefined method Symfony\Component\Debug\Exception\FatalThrowableError::getStatusCode() in /var/www/html/matching/app/Exceptions/Handler.php:57
96
+
97
+ Stack trace:
98
+
99
+ #0 /var/www/html/matching/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(112): App\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(Symfony\Component\Debug\Exception\FatalThrowableError))
100
+
101
+ #1 /var/www/html/matching/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(89): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
102
+
103
+ #2 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
104
+
105
+ #3 {main}
106
+
107
+ thrown {"exception":"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 1): Uncaught Error: Call to undefined method Symfony\Component\Debug\Exception\FatalThrowableError::getStatusCode() in /var/www/html/matching/app/Exceptions/Handler.php:57
108
+
109
+ Stack trace:
110
+
111
+ #0 /var/www/html/matching/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(112): App\Exceptions\Handler->render(Object(Illuminate\Http\Request), Object(Symfony\Component\Debug\Exception\FatalThrowableError))
112
+
113
+ #1 /var/www/html/matching/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(89): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
114
+
115
+ #2 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
116
+
117
+ #3 {main}
118
+
119
+ thrown at /var/www/html/matching/app/Exceptions/Handler.php:57)
120
+
121
+ [stacktrace]
122
+
123
+ #0 {main}
124
+
125
+
126
+
127
+ ```

1

修正

2018/05/06 02:21

投稿

FigHy
FigHy

スコア19

test CHANGED
File without changes
test CHANGED
@@ -60,7 +60,7 @@
60
60
 
61
61
  ```
62
62
 
63
- 138.111.111 www.laravelApp.jp:80
63
+ 138.111.111.111 www.laravelApp.jp:80
64
64
 
65
65
  ```
66
66