Skip to content

Commit

Permalink
Http api state Gone, NotModified
Browse files Browse the repository at this point in the history
  • Loading branch information
shoreward committed Jan 18, 2021
1 parent 1faf51a commit ef3fa7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tdapi/err.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const (
InvalidToken = Err("INVALID_TOKEN")
AccessDenied = Err("ACCESS_DENIED")
NotFound = Err("NOT_FOUND")
NotModified = Err("NOT_MODIFIED")
Gone = Err("GONE")
RateLimit = Err("RATE_LIMIT")
InternalServerError = Err("INTERNAL_SERVER_ERROR")
InvalidMethod = Err("INVALID_METHOD")
Expand All @@ -19,12 +21,16 @@ func (e Err) Error() string { return string(e) }

func (e Err) StatusCode() int {
switch e {
case NotModified:
return 304
case EmptyToken, InvalidToken, EmptySession:
return 401
case AccessDenied:
return 403
case NotFound:
return 404
case Gone:
return 410
case RateLimit:
return 429
case InternalServerError:
Expand Down

0 comments on commit ef3fa7d

Please sign in to comment.