hi All,
I deliberately turned off my MySQL to check how application (API) behaves, but I am seeing application trace even when I am in PRODUCTION model. I am using CodeIgniter 4 for API.
Please see complete Curl result as below.
This is definitely not secure. Could you please advise how to avoid trace in exception response. I tried try catch in my code, but this exception override my catch exception.
Code:
{
"title": "CodeIgniter\\Database\\Exceptions\\DatabaseException",
"type": "CodeIgniter\\Database\\Exceptions\\DatabaseException",
"code": 500,
"message": "Unable to connect to the database.\r\nMain connection [MySQLi]: No connection could be made because the target machine actively refused it",
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Database\\BaseConnection.php",
"line": 418,
"trace": [
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Database\\BaseConnection.php",
"line": 588,
"function": "initialize",
"class": "CodeIgniter\\Database\\BaseConnection",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Database\\BaseBuilder.php",
"line": 1585,
"function": "query",
"class": "CodeIgniter\\Database\\BaseConnection",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Validation\\Rules.php",
"line": 142,
"function": "get",
"class": "CodeIgniter\\Database\\BaseBuilder",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Validation\\Validation.php",
"line": 315,
"function": "is_unique",
"class": "CodeIgniter\\Validation\\Rules",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Validation\\Validation.php",
"line": 175,
"function": "processRules",
"class": "CodeIgniter\\Validation\\Validation",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Controller.php",
"line": 140,
"function": "run",
"class": "CodeIgniter\\Validation\\Validation",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\app\\Controllers\\Api\\Auth.php",
"line": 53,
"function": "validate",
"class": "CodeIgniter\\Controller",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\CodeIgniter.php",
"line": 902,
"function": "register",
"class": "App\\Controllers\\Api\\Auth",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\CodeIgniter.php",
"line": 457,
"function": "runController",
"class": "CodeIgniter\\CodeIgniter",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\CodeIgniter.php",
"line": 340,
"function": "handleRequest",
"class": "CodeIgniter\\CodeIgniter",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\public\\index.php",
"line": 67,
"function": "run",
"class": "CodeIgniter\\CodeIgniter",
"type": "->"
},
{
"file": "C:\\Applications\\projects\\php\\project-api\\vendor\\codeigniter4\\framework\\system\\Commands\\Server\\rewrite.php",
"line": 46,
"args": [
"C:\\Applications\\projects\\php\\project-api\\public\\index.php"
],
"function": "require_once"
}
]
}