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

Should be able to distinguish unset from invalid time properties #98

Merged
merged 4 commits into from
Sep 26, 2024

Conversation

brackendawson
Copy link
Contributor

Motivation

I have some error handling code after getting event end times and I want to distinguish events with no end time (fine) from events with invalid end times (not fine).

Changes

  • Define an error for this situation and make sure it is returned in the correct cases.

@brackendawson
Copy link
Contributor Author

brackendawson commented Sep 22, 2024

Looks like a fixed version of #73 would include this, can I help get it across the line?

@arran4
Copy link
Owner

arran4 commented Sep 23, 2024

Hi @brackendawson I'm not sure @ManoloTonto1 is coming back so it might be a good idea to incorporate his changes into yours. (It also has a merge conflict.)

The lint error this has is an easy fix with the solution in the error itself (package change.)

I think the issue with that one was just the go-version.

Happy to assist with the PR if you need it. I can create a chat if you have any questions.

arran4
arran4 previously approved these changes Sep 23, 2024
Copy link
Owner

@arran4 arran4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments: Good. Lint needs resolving, and I can help merging #73 if required. Minor suggestion included.

components.go Outdated
@@ -133,7 +133,7 @@ func (cb *ComponentBase) SetAllDayEndAt(t time.Time, props ...PropertyParameter)
func (cb *ComponentBase) getTimeProp(componentProperty ComponentProperty, expectAllDay bool) (time.Time, error) {
timeProp := cb.GetProperty(componentProperty)
if timeProp == nil {
return time.Time{}, errors.New("property not found")
return time.Time{}, ErrorPropertyNotFound
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good, however we can probably make it better with:

return time.Time{}, fmt.Errof("%w: %s", ErrorPropertyNotFound. componentProperty)

As it enhances it. I am very much in support of these updates.

@arran4 arran4 mentioned this pull request Sep 23, 2024
@arran4
Copy link
Owner

arran4 commented Sep 23, 2024

@brackendawson It seems I made a pull request into his pull request with my fixes for his issue (so I don't have to modify his commits etc.) ManoloTonto1#1 That would be a good place to start

@arran4
Copy link
Owner

arran4 commented Sep 23, 2024

Thanks

@ManoloTonto1
Copy link

Hi @brackendawson I'm not sure @ManoloTonto1 is coming back so it might be a good idea to incorporate his changes into yours. (It also has a merge conflict.)

The lint error this has is an easy fix with the solution in the error itself (package change.)

I think the issue with that one was just the go-version.

Happy to assist with the PR if you need it. I can create a chat if you have any questions.

Hey @arran4 i will get back to this and the other PR later today. I have a stupidly busy day today 😩. Once i get home I will tackle these PR's 😉

@arran4
Copy link
Owner

arran4 commented Sep 23, 2024

Hey @ManoloTonto1 sorry to drop your name like that! Thanks! I'm not sure it's urgent but the promptness is appreciated! Speak soon!

@brackendawson
Copy link
Contributor Author

brackendawson commented Sep 25, 2024

@arran4 it looks like either the lint must be ignored, or support for Go 1.14 and 1.15 be dropped. Which would you like?

NB: your go.mod file claims that the code targets 1.13. I like to include a workflow to make sure it builds with the version in go.mod.

Copy link

@ManoloTonto1 ManoloTonto1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@arran4
Copy link
Owner

arran4 commented Sep 26, 2024

@ManoloTonto1 Will this create a merge conflict if I merge it a head of #73 did you want to pull the commits from this into yours? (Ensuring that @brackendawson 's commits still remain in history

@arran4
Copy link
Owner

arran4 commented Sep 26, 2024

@arran4 it looks like either the lint must be ignored, or support for Go 1.14 and 1.15 be dropped. Which would you like?

NB: your go.mod file claims that the code targets 1.13. I like to include a workflow to make sure it builds with the version in go.mod.

Given the new requirement for multiple error handling, I would bump it to 1.20 as per: #73

I am waiting on that before continuing with this. (Larger PRs are harder to update and review.)

And test the target forever
name: Test
permissions:
contents: read
strategy:
matrix:
go-version: ['1.14.15', '1.15.15', '1.16.15', '1.17.13', '1.22.3']
go-version: ['oldstable', 'stable']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My gut feeling is that this should match go.mod and then run to stable.

I didn't know it supported stable even!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stable is pretty cool though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately because one uses go-version: <version> and the other uses go-version-file: <path>, they can't live in the same matrix.

@brackendawson
Copy link
Contributor Author

Hold up a minute, not all the matrix is being included in PR checks..

@brackendawson
Copy link
Contributor Author

Ah, now they are:
image

I'm happy with that.

@arran4 arran4 merged commit 229e6a3 into arran4:master Sep 26, 2024
10 checks passed
@arran4
Copy link
Owner

arran4 commented Sep 26, 2024

Took us a while.

Do you need this version released or should we wait for the other PR?

@brackendawson
Copy link
Contributor Author

Thanks! I'm not in a hurry, so we can wait and do a release with all of the error handling at once. I can also skip ahead and pin a commit in my project if I want.

@brackendawson brackendawson deleted the time-prop-err branch September 26, 2024 13:38
@arran4
Copy link
Owner

arran4 commented Sep 26, 2024

All good. Night!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants