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);
|
||||
|
||||
$database = database::get_instance();
|
||||
$setting = setting::get_instance();
|
||||
|
||||
// Fix the current working directory. See documentation on this class
|
||||
// variable for details.
|
||||
chdir($this->current_working_directory);
|
||||
|
||||
// Run any queued creates.
|
||||
// Run any queued actions.
|
||||
foreach($this->queued_database_actions as $queued_database_action) {
|
||||
switch($queued_database_action['method']) {
|
||||
case 'create':
|
||||
@ -658,7 +659,16 @@ final class request {
|
||||
// Override whatever headers might have already been set.
|
||||
$this->set_default_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 {
|
||||
// If we got here, no errors have occurred.
|
||||
@ -681,7 +691,16 @@ final class request {
|
||||
|
||||
// Output the response
|
||||
$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) {
|
||||
@ -703,7 +722,16 @@ final class request {
|
||||
|
||||
$this->set_default_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