jargons.dev
jargons.dev copied to clipboard
Enhancement: Implement Uniform Error Handling in `lib` Scripts
The lib scripts in the src/lib
directory currently have inconsistent error handling practices. Some functions throws the erros correctly using throw
in the catch
block of the try...catch
, while some uses console.log
in catch blocks, and some others lack try...catch
blocks altogether. To improve the maintainability and reliability of our codebase, we should implement try...catch
blocks in all functions within the lib scripts and ensure that errors are thrown uniformly.
Scope of Work:
- Implement
try...catch
blocks in all functions within thesrc/lib
directory. - Ensure that errors are thrown uniformly using the
throw
keyword in catch blocks. - Review existing
console.log
statements in catch blocks and replace them with appropriate error throwing.
Additional Considerations:
- Use descriptive error messages to provide meaningful information about the encountered issue.
- Follow a consistent format for error messages to make them easily identifiable and understandable.
- Consider creating a utility function for error handling to avoid code duplication and ensure uniformity.
Submission Guidelines:
- Ensure that all functions within the
src/lib
directory have propertry...catch
blocks implemented. - Review and refactor existing error handling code to adhere to the new uniform error throwing approach.
Addition Information:
- Kindly work only on replacing the
console.log
in thecatch
block of thetry..catch
; Its important to not remove theconsole.log
in thetry
blocks or anywhere else for now. - Are you thinking of a
logger
!? 😜 great thought, but we don't really want that yet (atleast at the time I write this issue), it might be an overkill... If anything changes, we will communicate this 👍