dingo / dingo/api

Internal request not returning errors

Open
#1,347 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I am trying to get the internal request to work on laravel 5.2. On the backend if validation fails a `ValidationHttpException` is thrown and I have the internal request wrapped in a try catch statement.
```php
try
{
app(Dispatcher::class)->be(\Auth::user())->json($request->all())->post('/api/v1/claims');
}
catch (ValidationHttpException $e)
{
dd($e->getErrors());
}
```
If I try to catch `InternalHttpException` instead then I can dump the exception but there are no errors returned. Going through the stack trace it brought me to the Dispatcher file where it rethrows any caught exceptions as `InternalHttpException`. Is this expected behavior? My main concern is returning the errors back to the frontend to display the errors.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Dispatcher code mentioned in the stack trace, focusing on where caught exceptions are rethrown as InternalHttpException. Compare that path with ValidationHttpException and inspect how the internal request response reaches the frontend. Done means validation errors remain available to the caller while preserving the expected exception behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.