PlayStation 4 error codes are available on the PlayStation website. Scroll down on the homepage and click Support on the bottom left side of the screen.
This link brings up the PlayStation Knowledge Center. Click on PS4: Error Codes in the Most Popular Solutions section to access a complete list of possible error codes for PlayStation 4.
The PlayStation website does not provide error codes for older versions of the game console. User-generated content, however, is available online at PS3blog.net, which provides a list of PS3 and PSN error codes. Search for "error codes" on the home page to access the content.