mirror of
https://github.com/beestat/app.git
synced 2025-07-09 03:04:07 -04:00
Added more debug info to responses when in dev mode
This commit is contained in:
parent
9bd8f5e2cc
commit
635bb2242b
@ -594,12 +594,13 @@ final class request {
|
|||||||
$this->total_time = (microtime(true) - $this->begin_timestamp);
|
$this->total_time = (microtime(true) - $this->begin_timestamp);
|
||||||
|
|
||||||
$database = database::get_instance();
|
$database = database::get_instance();
|
||||||
|
$setting = setting::get_instance();
|
||||||
|
|
||||||
// Fix the current working directory. See documentation on this class
|
// Fix the current working directory. See documentation on this class
|
||||||
// variable for details.
|
// variable for details.
|
||||||
chdir($this->current_working_directory);
|
chdir($this->current_working_directory);
|
||||||
|
|
||||||
// Run any queued creates.
|
// Run any queued actions.
|
||||||
foreach($this->queued_database_actions as $queued_database_action) {
|
foreach($this->queued_database_actions as $queued_database_action) {
|
||||||
switch($queued_database_action['method']) {
|
switch($queued_database_action['method']) {
|
||||||
case 'create':
|
case 'create':
|
||||||
@ -658,7 +659,16 @@ final class request {
|
|||||||
// Override whatever headers might have already been set.
|
// Override whatever headers might have already been set.
|
||||||
$this->set_default_headers();
|
$this->set_default_headers();
|
||||||
$this->output_headers();
|
$this->output_headers();
|
||||||
die(json_encode($this->response));
|
|
||||||
|
$response = $this->response;
|
||||||
|
if(
|
||||||
|
empty($this->error_detail) === false &&
|
||||||
|
in_array($setting->get('environment'), ['dev', 'dev_live', 'stage'])
|
||||||
|
) {
|
||||||
|
$response['data']['error_detail'] = $this->error_detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
die(json_encode($response));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If we got here, no errors have occurred.
|
// If we got here, no errors have occurred.
|
||||||
@ -681,7 +691,16 @@ final class request {
|
|||||||
|
|
||||||
// Output the response
|
// Output the response
|
||||||
$this->output_headers();
|
$this->output_headers();
|
||||||
die(json_encode($this->response));
|
|
||||||
|
$response = $this->response;
|
||||||
|
if(
|
||||||
|
empty($this->error_detail) === false &&
|
||||||
|
in_array($setting->get('environment'), ['dev', 'dev_live', 'stage'])
|
||||||
|
) {
|
||||||
|
$response['data']['error_detail'] = $this->error_detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
die(json_encode($response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(\Exception $e) {
|
catch(\Exception $e) {
|
||||||
@ -703,7 +722,16 @@ final class request {
|
|||||||
|
|
||||||
$this->set_default_headers();
|
$this->set_default_headers();
|
||||||
$this->output_headers();
|
$this->output_headers();
|
||||||
die(json_encode($this->response));
|
|
||||||
|
$response = $this->response;
|
||||||
|
if(
|
||||||
|
empty($this->error_detail) === false &&
|
||||||
|
in_array($setting->get('environment'), ['dev', 'dev_live', 'stage'])
|
||||||
|
) {
|
||||||
|
$response['data']['error_detail'] = $this->error_detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
die(json_encode($response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user