Importance of having descriptive error

Application / API Development

Similarly, when developing software and using APIs, my colleagues and myself do not often plan for errors and simply return general values such as true or false. As a previous frontend developer, in case of errors with the APIs I worked with, I often had to check in the backend codes to understand what the source of the problem.

Why is this important?

After deploying our latest work on a demo server, on launching the application, a 500 Server Error welcomes us. A front end colleague and myself try to debug it as the system works on our local systems. Turns out, after a few hustle, we’ve missed a configuration option. Once added, the error disappears and the application works as expected.

  • save time and focus on the most important features
  • code a Minimum Viable Project (MVP) with least effort and time

Try Catch

Sometimes even if I write the codes myself, after a few days when an error arises, I struggle to understand what is happening, especially without a try catch statement or a generic one on encompassing the whole function.

Loggers

Another interesting solution is to use Loggers. In JavaScript, you can use console object to log significant part of a function.

Research

https://news.codecademy.com/errors-in-code-think-differently/ https://cxl.com/blog/error-messages/

Logging libraries NodeJS

https://www.npmjs.com/package/log4js https://www.npmjs.com/package/bunyan

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abdallah Yashir

Abdallah Yashir

Senior Software Developer, Writer, Amateur Photographer, Reader