-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle server closing grpc stream (#1164)
Handle server closing grpc stream
- Loading branch information
Josef Karasek
authored
Aug 2, 2023
1 parent
b8e2b72
commit cec3ddc
Showing
5 changed files
with
131 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cloudslack | ||
|
||
type CloudSlackErrorType string | ||
|
||
const ( | ||
CloudSlackErrorQuotaExceeded CloudSlackErrorType = "QuotaExceeded" | ||
) | ||
|
||
type CloudSlackError struct { | ||
Msg string `json:"message"` | ||
ErrType CloudSlackErrorType `json:"type"` | ||
} | ||
|
||
func NewQuotaExceededError(msg string) *CloudSlackError { | ||
return &CloudSlackError{ | ||
Msg: msg, | ||
ErrType: CloudSlackErrorQuotaExceeded, | ||
} | ||
} | ||
|
||
func (e *CloudSlackError) Error() string { | ||
return e.Msg | ||
} | ||
|
||
func (e *CloudSlackError) IsQuotaExceeded() bool { | ||
return e.ErrType == CloudSlackErrorQuotaExceeded | ||
} | ||
|
||
func IsQuotaExceededErr(err error) bool { | ||
if err == nil { | ||
return false | ||
} | ||
e, ok := err.(*CloudSlackError) | ||
return ok && e.IsQuotaExceeded() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters