Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve and Standardize Error Handling and Logging Strategy #6

Open
AbdulRashidReshamwala opened this issue Oct 1, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@AbdulRashidReshamwala
Copy link
Contributor

Improve and Standardize Error Handling and Logging Strategy

Description

While we already use pino for logging in our SDK, our error handling approach is inconsistent across the codebase. We need to standardize our error handling and improve our use of the existing logging system to enhance debugging, error reporting, and overall reliability of the SDK. Some error messages donot provide the entire context on what caused the issue and what action user to take to solve the issue.

//eg: does not give us the entire information what can cause the identifier mismatch 
//and there are no logs showing what is the expected identifier and what was the indetifier that was calculated
throw new ProofNotVerifiedError('Identifier Mismatch')

Goals

  • Implement a consistent error handling mechanism across the SDK
  • Standardize the use of the existing pino logger
  • Create custom error types for better error identification
  • Improve error messages for better developer experience

Current State

We currently use pino for logging:

@Girishbari
Copy link
Contributor

let me handle this

@Girishbari
Copy link
Contributor

Hey @AbdulRashidReshamwala I can see the first 2 major goals are already implemented I can observe in the codebase there is already a custom handling mechanism and most of all files have a logger for log extra info, I can observe there might be need for custom error types and improve existing error message.

So do you want me to go into that or maybe I am entirely wrong with my observation and we need to achieve all the listed goals

@Kushal7788
Copy link
Collaborator

Kushal7788 commented Oct 14, 2024

Hi @Girishbari. We have moved to a custom implementation of logging. We are no longer using pino. Currently across all the files we are using info logs. We need to segregate these logs based on the type of information we want to convey to the user. New goals are as follows

  1. Add logs according to the level (error - when we get an exceptions or errors, info - to get relevant details as users call different methods, warn - when some data is not present or may lead to an error if not corrected, etc) across the SDK
  2. Add more detail custom error messages which are user friendly and convey relevant information to resolve the errors.

@Girishbari
Copy link
Contributor

Yeah this can be done

@Girishbari
Copy link
Contributor

hi @Kushal7788 I revalidated both points I have added proper logs message type wherever required and there are already good error messages provided. Which conveys proper suggestion and error message and also provides most probable solution although I made few tweaks here and there
PR #14

@Girishbari
Copy link
Contributor

Hi @Kushal7788, there are validation methods for respective public methods then why codebase is only using validateFunctionParams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants