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

Introduce QuotaLimitExceeded error #45

Merged
merged 1 commit into from
Mar 30, 2020
Merged

Introduce QuotaLimitExceeded error #45

merged 1 commit into from
Mar 30, 2020

Conversation

achilleasa
Copy link
Contributor

This PR adds a new generic error type for representing failures due to quota limit checkes.

Copy link
Member

@hmlanigan hmlanigan left a comment

Choose a reason for hiding this comment

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

LGTM

@achilleasa
Copy link
Contributor Author

$$merge$$

1 similar comment
@mitechie
Copy link

$$merge$$

@jujubot jujubot merged commit 3fe2366 into juju:master Mar 30, 2020
@achilleasa achilleasa deleted the introduce-quota-limit-exceeded-error branch March 30, 2020 14:07

// QuotaLimitExceededf returns an error which satisfies IsQuotaLimitExceeded.
func QuotaLimitExceededf(format string, args ...interface{}) error {
return &quotaLimitExceeded{wrap(nil, format, "", args...)}
Copy link
Member

Choose a reason for hiding this comment

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

So I noticed that Err itself is returned as a struct, not as a *struct. Given that quotaLimitExceeded is-a Err, shouldn't we just return quotaLimitExceeded here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. There is really no point in returning pointers here (or using pointer receivers for Error for that matter). I just emulated (a.k.a copy/paste/modify) the behavior from the other error types in the same file.

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.

None yet

5 participants