What is the error handling status code of koa for web requests?

I would like to ask if there is any middleware that reports an error, or how to deal with these states. Beginner koa writes several interfaces, but I don"t quite understand how to return the status code returned to the front end according to the error

.
200400403
Apr.02,2021

take the article system as an example

  1. everything is fine
  2. not logged in to 401
  3. logs in, but does not have permission, such as deleting articles that are not self-published
  4. API parameters are mispassed 400
  5. the requested article does not exist
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48beb-4421e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48beb-4421e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?