CodeIgniter Forums
How I can extend CodeIgniter\HTTP\Response::statusCodes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: How I can extend CodeIgniter\HTTP\Response::statusCodes (/showthread.php?tid=75069)



How I can extend CodeIgniter\HTTP\Response::statusCodes - XTAZ - 12-16-2019

Hello!

How I can extend CodeIgniter\HTTP\Response:: statusCodes?

I work with https://github.com/smi2/phpClickHouse and https://clickhouse.yandex/docs/en/.

-> If I use wrong username/password for db
-> db generate error with code 193
-> phpClickHouse throws exception with code 193
-> CodeIgniter throws exception about code 193 doents exists
-> I cant view ClickHouse error

https://prnt.sc/qbqcoe
https://prnt.sc/qbqbgr

Perhaps it is not necessary to throw an exception if the http code is unknown?

==========
Update
Different codes throw different codes

How can I disable "throw HTTPException :: forUnkownStatusCode" without copy all HTTP library to /app?


RE: How I can extend CodeIgniter\HTTP\Response::statusCodes - InsiteFX - 12-19-2019

You need to read the CodeIgniter 4 User Guide.

Creating Core System Classes


RE: How I can extend CodeIgniter\HTTP\Response::statusCodes - arnisraido - 06-28-2020

(12-19-2019, 11:57 AM)InsiteFX Wrote: You need to read the CodeIgniter 4 User Guide.

Creating Core System Classes

I have the same question. I am using Facebook API SDK for web authentication. I don't want to change API library so it would return or override different status codes. E..g. - HTTP status code "190" is returned, if AccessToken has expired. 

InsiteFX,
reading itself will not be enough to fix it Smile 

And I did not find any direct documentation on this. I also do not want to duplicate HTTP Response Class just to add single status code.