Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
laravel-adminpanel
Commits
5a9db0b6
Unverified
Commit
5a9db0b6
authored
Mar 11, 2018
by
Viral Solani
Committed by
GitHub
Mar 11, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #164 from viralsolani/analysis-zGoGrO
Apply fixes from StyleCI
parents
c2293288
3c037a81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
Handler.php
app/Exceptions/Handler.php
+10
-18
No files found.
app/Exceptions/Handler.php
View file @
5a9db0b6
...
@@ -4,14 +4,12 @@ namespace App\Exceptions;
...
@@ -4,14 +4,12 @@ namespace App\Exceptions;
use
Exception
;
use
Exception
;
use
Illuminate\Auth\AuthenticationException
;
use
Illuminate\Auth\AuthenticationException
;
use
Illuminate\Database\Eloquent\ModelNotFoundException
;
use
Illuminate\Foundation\Exceptions\Handler
as
ExceptionHandler
;
use
Illuminate\Foundation\Exceptions\Handler
as
ExceptionHandler
;
use
Illuminate\Session\TokenMismatchException
;
use
Illuminate\Session\TokenMismatchException
;
use
Illuminate\
Database\Eloquent\ModelNotFound
Exception
;
use
Illuminate\
Validation\Validation
Exception
;
use
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
;
use
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
;
use
Symfony\Component\HttpKernel\Exception\BadRequestHttpException
;
use
Illuminate\Validation\ValidationException
;
class
Handler
extends
ExceptionHandler
class
Handler
extends
ExceptionHandler
{
{
...
@@ -68,33 +66,27 @@ class Handler extends ExceptionHandler
...
@@ -68,33 +66,27 @@ class Handler extends ExceptionHandler
return
redirect
()
->
back
()
->
withInput
()
->
withFlashDanger
(
$exception
->
getMessage
());
return
redirect
()
->
back
()
->
withInput
()
->
withFlashDanger
(
$exception
->
getMessage
());
}
}
if
(
strpos
(
$request
->
url
(),
'/api/'
)
!==
false
)
if
(
strpos
(
$request
->
url
(),
'/api/'
)
!==
false
)
{
{
\Log
::
debug
(
'API Request Exception - '
.
$request
->
url
()
.
' - '
.
$exception
->
getMessage
()
.
(
!
empty
(
$request
->
all
())
?
' - '
.
json_encode
(
$request
->
except
([
'password'
]))
:
''
));
\Log
::
debug
(
"API Request Exception - "
.
$request
->
url
()
.
" - "
.
$exception
->
getMessage
()
.
(
!
empty
(
$request
->
all
())
?
' - '
.
json_encode
(
$request
->
except
([
'password'
]))
:
''
));
if
(
$exception
instanceof
MethodNotAllowedHttpException
)
if
(
$exception
instanceof
MethodNotAllowedHttpException
)
{
{
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
'Please check HTTP Request Method. - MethodNotAllowedHttpException'
);
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
'Please check HTTP Request Method. - MethodNotAllowedHttpException'
);
}
}
if
(
$exception
instanceof
NotFoundHttpException
)
if
(
$exception
instanceof
NotFoundHttpException
)
{
{
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
'Please check your URL to make sure request is formatted properly. - NotFoundHttpException'
);
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
'Please check your URL to make sure request is formatted properly. - NotFoundHttpException'
);
}
}
if
(
$exception
instanceof
GeneralException
)
if
(
$exception
instanceof
GeneralException
)
{
{
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
$exception
->
getMessage
());
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
$exception
->
getMessage
());
}
}
if
(
$exception
instanceof
ModelNotFoundException
)
if
(
$exception
instanceof
ModelNotFoundException
)
{
{
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
'Item could not be found. Please check identifier.'
);
return
$this
->
setStatusCode
(
403
)
->
respondWithError
(
'Item could not be found. Please check identifier.'
);
}
}
if
(
$exception
instanceof
ValidationException
)
if
(
$exception
instanceof
ValidationException
)
{
{
\Log
::
debug
(
'API Validation Exception - '
.
json_encode
(
$exception
->
validator
->
messages
()));
\Log
::
debug
(
"API Validation Exception - "
.
json_encode
(
$exception
->
validator
->
messages
()));
return
$this
->
setStatusCode
(
422
)
->
respondWithError
(
$exception
->
validator
->
messages
());
return
$this
->
setStatusCode
(
422
)
->
respondWithError
(
$exception
->
validator
->
messages
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment