-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: validate presence of price label in issue before checking requir… #125
base: development
Are you sure you want to change the base?
Conversation
@0x4007 could you please review |
Can you link the thread instead of screenshots? Better to QA when we can use it directly. |
src/handlers/shared/start.ts
Outdated
const priceLabel = labels.find((label: Label) => label.name.startsWith("Price: ")); | ||
|
||
if (!priceLabel) { | ||
throw logger.error("No price label is set to calculate the duration", { issueNumber: issue.number }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about error aggregation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as gentlemen said it sounded complex, i just changed the order, but I can make the aggregation, no problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you think its okay to aggregate only the price label with the errors from checkRequirements? or you mean ALL the errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that I want to avoid the situation where a user steps through every error and loses patience.
For example:
- you must set your wallet before starting the issue
And then they set their wallet and try start again
- this is not a business priority please start tasks with level 3 priority or higher
I feel like there were other temporary errors I can't recall at the moment. I figured aggregation would prevent this from happening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ended up aggregating them in feat: aggregate price label and requirements errors , you can take a look at koya0/.ubiquity-os#26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other errors that I thought maybe could be aggregated were "Only collaborators can be assigned to this issue." and "You have reached your max task limit. Please close out some tasks before assigning new ones."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that I want to avoid the situation where a user steps through every error and loses patience.
For example:
- you must set your wallet before starting the issue
And then they set their wallet and try start again
- this is not a business priority please start tasks with level 3 priority or higher
I feel like there were other temporary errors I can't recall at the moment. I figured aggregation would prevent this from happening
Got it! Its a really good idea. I think the only problem is that it would be a lil complex to aggregate errors from differents plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just worry about the errors in this plugin for now.
i ended up deleting those issues, but i created other ones: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aggregated errors QA looks good!
QA seems fine: Meniole#59 Please bump Also, it appears that a task with no time estimate can be started if it has a price and a priority, I don't know if that's expected. |
I suppose that technically speaking all we need is a |
Even though it works fine, I think that returning a string this way is not really clear, programming side. Why not using |
/ask Could this pull-request be rewritten using |
Yes, the pull request can be refactored to utilize the For example, in your const errors: Error[] = [];
if (!priceLabel) {
errors.push(new Error("No price label is set to calculate the duration"));
}
if (/* another condition */) {
errors.push(new Error("Another error message"));
}
if (errors.length > 0) {
throw new AggregateError(errors, "Multiple errors occurred during the start process");
} This approach ensures that all encountered issues are reported simultaneously, providing a comprehensive overview of what went wrong. Additionally, it aligns with your project's commitment to code quality by leveraging TypeScript's robust type system and integrating seamlessly with tools like ESLint and Prettier. Make sure to update your Jest tests to handle Implementing |
is this class already implemented? |
You should be able to import it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError |
I ended up not using |
The formatting is ok. The thing I wanted to avoid is cb32e3f#diff-47224fac5bab974df0f6fb9704d6fbb0f06375b3e98285797826104537bda3ccR89 where I would prefer to only throw one error and the SDK would handle the display. Because by doing so, what is the linked error stack? I can't edit the comment so I can't see it. |
I think don't use |
now I just throw new AggregateError(startErrors). For the display not to be redundant, in SDK you should only get the .message parameter from the Errors
|
if I dont use |
…ements
Resolves #99