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

feat: add custom errors #468

Closed
gershon opened this issue Sep 25, 2024 · 21 comments
Closed

feat: add custom errors #468

gershon opened this issue Sep 25, 2024 · 21 comments
Assignees
Labels
app:sdk Ark Project SDK lang:js Pull requests that update Javascript code ODHack8 Only dust 8 type: enhancement New feature or request

Comments

@gershon
Copy link
Contributor

gershon commented Sep 25, 2024

Add and use sdk core custom errors to facilitate sdk usage and debug.

  • errors should have a type (INVALID_START_AMOUNT, INVALID_END_DATE, ...)
  • errors should have a message with context ("Invalid start date. Start date (${startDate}) cannot be in the past.", ...)
  • errors should include a link to related docs (https://docs.arkproject.dev/)
@gershon gershon added type: enhancement New feature or request lang:js Pull requests that update Javascript code app:sdk Ark Project SDK ODHack8 Only dust 8 labels Sep 25, 2024
@Iwueseiter
Copy link

Hi @gershon can I work on this?

@Jemiiah
Copy link

Jemiiah commented Sep 25, 2024

I would love to work on this issue @gershon here is my profile: https://app.onlydust.com/u/Jemiiah
I made over 50 contribution to onlydust

@vickiddev
Copy link

hello @gershon please i would love to work on this issue tomorrow once the OD hack starts :)

@Kaminar-i
Copy link

hello @gershon please can i work on this issue tomorrow once the OD hack starts :)

@martinvibes
Copy link

hello @gershon please i would love to work on this issue tomorrow once the OD hack starts :)

@ShantelPeters
Copy link
Contributor

Hi @gershon would be happy to take up this issue by tomorrow

@NueloSE
Copy link

NueloSE commented Sep 26, 2024

@gershon kindly assign me this task as i would like to make it my first contribution to this project.

@lordshashank
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I have been contributing in odhacks for quite some time now and have expertise in rust and blockchain specs , few of them are

  • Contributed to Floresta as Summer of Bitcoin 2024 fellow
  • contributed to RUst lang's codegen GCC and implemented new traits and tests.
  • Contributed to starknet rust devnet in odhack

How I plan on tackling this issue

I will integrate sdk core custom errorin sdk for better error handling and ease of debugging
I will add error messages with proper context and links to debug them.

@Mystic-Nayy
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Web3/frontend developer
With a lot of experiences in open source contribution.

How I plan on tackling this issue

I will

  1. Define Custom Errors: Create custom error types (e.g., INVALID_START_AMOUNT, INVALID_END_DATE) in the SDK core, using an enum to represent different error types. Include fields for error message, context, and a link to the docs.

  2. Error Messages with Context: Implement detailed error messages that include relevant context (e.g., "Invalid start date. Start date (${startDate}) cannot be in the past.")

@aji70
Copy link

aji70 commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i'm a solidity and cairo smart contract developer with over 2 years experience and belive i have the skill set for the task

@NueloSE
Copy link

NueloSE commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i am a frontend developer with experience using JS and TS for type safety

How I plan on tackling this issue

I will start by defining the custom error types that I need to create, such as INVALID_START_AMOUNT, INVALID_END_DATE, etc. These error types will help categorize specific issues that may arise during SDK usage.
Create Error Messages:

For each error type, I will craft a meaningful error message that provides context. For example, I will create a message like "Invalid start date. Start date (${startDate}) cannot be in the past." This will give users a clear understanding of what went wrong.
Link to Documentation:

I will ensure that each error message includes a link to the relevant documentation (https://docs.arkproject.dev/) to assist users in troubleshooting and understanding the error better.
Implement Custom Errors:

I will implement these custom errors in the SDK core, making sure to use the appropriate syntax and structure as per the coding standards of the project. I will ensure that these errors are thrown at the correct instances where validation fails.
Test Error Handling:

After implementing the custom errors, I will write tests to validate that the errors are thrown correctly under the intended circumstances. This will help confirm that the error handling works as expected.
Update Documentation:

I will update any relevant documentation to include information about the new custom errors, their meanings, and how they can be resolved, ensuring that developers using the SDK have clear guidance.

@GoSTEAN
Copy link

GoSTEAN commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in building SDKs and handling error management in various systems. I’ve implemented custom error handling in JavaScript/TypeScript projects, providing developers with clear error messages, types, and links to relevant documentation. This ensures a smooth debugging experience and improves SDK usability. My familiarity with tools like Next.js and TypeScript enables me to create a robust error-handling framework for this project.

How I plan on tackling this issue

I would start by creating a custom error class that standardizes error types, messages, and links to documentation. This class would include parameters for the error type (e.g., INVALID_START_AMOUNT), a message that provides context (e.g., Invalid start date. Start date (${startDate}) cannot be in the past.), and a link to the related documentation for easy reference. I would then integrate these custom errors throughout the SDK, ensuring consistency and clarity for users. Finally, I would ensure that each error includes a link to the appropriate section in the documentation to facilitate troubleshooting.

@martinvibes
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

hello i am a frontend dev and blockchain developer
please can i work on this issue :) and would love to be a contributor

How I plan on tackling this issue

Have a type (e.g., INVALID_START_AMOUNT, INVALID_END_DATE).
Include a message with context (e.g., "Invalid start date. Start date (${startDate}) cannot be in the past.").
Provide a link to related documentation (e.g., https://docs.arkproject.dev/).

@ShantelPeters
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i am a blockchain developer with strong background in cario, typescript,javascript etc. i will love to work on this issue, kindly assign

How I plan on tackling this issue

Implement custom SDK errors by defining error types such as INVALID_START_AMOUNT and INVALID_END_DATE, along with contextual messages like "Invalid start date. Start date (${startDate}) cannot be in the past." Each error should also include a link to the relevant documentation at https://docs.arkproject.dev/ to aid in debugging and enhance user experience.

@bhavyagosai
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hey, I am Bhavya, a seasoned frontend engineer with two years of professional experience. I have been working with react, react native, nextjs, typescript and javascript and have become very proficient in it.

How I plan on tackling this issue

To approach the problem, we can create a custom error handling system that includes error types, context-specific messages, and documentation links.

Each error can include:

An errorType that describes the nature of the error.
A message that provides the specific context.
A documentationLink to guide developers to relevant sections in your docs.

This approach improves SDK usage by:

Providing meaningful error messages with context.
Guiding developers to the relevant part of the documentation.
Facilitating debugging with clear and categorized error types.

@ptisserand
Copy link
Contributor

Hi @NueloSE any update on this?
ODHack end is quite near.

@NueloSE
Copy link

NueloSE commented Oct 4, 2024

@ptisserand I'd need more context on

  • where am I defining the errors
  • At what point in the SDK usage am I to throw those errors...

This would help me implement, use, and link it to the related docs.

Kindly assist

@gershon
Copy link
Contributor Author

gershon commented Oct 4, 2024

Hi @NueloSE,

You should create your contribution branch from feat/contract-v2 as it contains latest changes to be released soon.

Lmk if you need more guidances or informations.

@NueloSE
Copy link

NueloSE commented Oct 4, 2024

Thank you this makes more sense now, I will be making a pr b4 end of 2mrw

@NueloSE
Copy link

NueloSE commented Oct 14, 2024

@gershon I made a PR and no review yet...

@gershon
Copy link
Contributor Author

gershon commented Oct 14, 2024

Hi @NueloSE, I'll review it shortly.

gershon pushed a commit that referenced this issue Oct 16, 2024
## Description

This PR adds custom error handling to this project by defining several
new error types. These errors are defined in the
packages/core/src/errors directory.

## What type of PR is this? (check all applicable)

- [x] 🍕 Feature (`feat:`)
- [ ] 🐛 Bug Fix (`fix:`)
- [ ] 📝 Documentation Update (`docs:`)
- [ ] 🎨 Style (`style:`)
- [ ] 🧑‍💻 Code Refactor (`refactor:`)
- [ ] 🔥 Performance Improvements (`perf:`)
- [ ] ✅ Test (`test:`)
- [ ] 🤖 Build (`build:`)
- [ ] 🔁 CI (`ci:`)
- [ ] 📦 Chore (`chore:`)
- [ ] ⏩ Revert (`revert:`)
- [ ] 🚀 Breaking Changes (`BREAKING CHANGE:`)

## Related Tickets & Documents
Fixes #468

## Added tests?

- [x] 👍 yes
- [ ] 🙅 no, because they aren't needed
- [ ] 🙋 no, because I need help


## Added to documentation?

- [ ] 📜 README.md
- [ ] 📓 Documentation
- [x] 🙅 no documentation needed
@ptisserand
Copy link
Contributor

Closed by #480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:sdk Ark Project SDK lang:js Pull requests that update Javascript code ODHack8 Only dust 8 type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests