2021-08-14 09:04:58 -07:00
|
|
|
module Errors
|
|
|
|
class Base < StandardError
|
2021-08-19 08:50:24 -07:00
|
|
|
def status
|
|
|
|
500
|
|
|
|
end
|
|
|
|
|
|
|
|
def code
|
|
|
|
@code ||= self.class.name.sub('Errors::', '').underscore
|
|
|
|
end
|
2022-01-02 15:31:55 -08:00
|
|
|
|
|
|
|
def locale_tag
|
|
|
|
@locale_tag ||= "errors.#{code}"
|
|
|
|
end
|
2021-08-19 08:50:24 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
class BadRequest < Base
|
|
|
|
def status
|
|
|
|
400
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class InvalidBanDuration < BadRequest
|
2021-08-14 09:04:58 -07:00
|
|
|
end
|
|
|
|
|
2021-08-19 08:50:24 -07:00
|
|
|
class Forbidden < Base
|
|
|
|
def status
|
|
|
|
403
|
|
|
|
end
|
2021-08-14 09:04:58 -07:00
|
|
|
end
|
2022-01-02 15:31:55 -08:00
|
|
|
|
|
|
|
class SelfAction < Forbidden
|
|
|
|
end
|
|
|
|
|
|
|
|
class FollowingSelf < SelfAction
|
|
|
|
end
|
|
|
|
|
|
|
|
class NotFound < Base
|
|
|
|
def status
|
|
|
|
404
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class UserNotFound < NotFound
|
|
|
|
end
|
2022-04-18 12:24:15 -07:00
|
|
|
|
|
|
|
# region User Blocking
|
|
|
|
class Blocked < Forbidden
|
|
|
|
end
|
|
|
|
|
|
|
|
class OtherBlockedSelf < Blocked
|
|
|
|
end
|
|
|
|
|
|
|
|
class BlockingSelf < SelfAction
|
|
|
|
end
|
|
|
|
|
|
|
|
class AskingOtherBlockedSelf < OtherBlockedSelf
|
|
|
|
end
|
|
|
|
|
|
|
|
class FollowingOtherBlockedSelf < OtherBlockedSelf
|
|
|
|
end
|
|
|
|
|
|
|
|
class SelfBlockedOther < Blocked
|
|
|
|
end
|
|
|
|
|
|
|
|
class AskingSelfBlockedOther < SelfBlockedOther
|
|
|
|
end
|
|
|
|
|
|
|
|
class FollowingSelfBlockedOther < SelfBlockedOther
|
|
|
|
end
|
|
|
|
|
|
|
|
class AnsweringOtherBlockedSelf < OtherBlockedSelf
|
|
|
|
end
|
|
|
|
|
|
|
|
class AnsweringSelfBlockedOther < SelfBlockedOther
|
|
|
|
end
|
2022-06-09 10:44:58 -07:00
|
|
|
|
|
|
|
class CommentingSelfBlockedOther < SelfBlockedOther
|
|
|
|
end
|
|
|
|
|
|
|
|
class CommentingOtherBlockedSelf < OtherBlockedSelf
|
|
|
|
end
|
2022-06-09 10:49:24 -07:00
|
|
|
|
|
|
|
class ReactingSelfBlockedOther < SelfBlockedOther
|
|
|
|
end
|
|
|
|
|
|
|
|
class ReactingOtherBlockedSelf < OtherBlockedSelf
|
|
|
|
end
|
2022-04-18 12:24:15 -07:00
|
|
|
# endregion
|
2021-08-19 08:50:24 -07:00
|
|
|
end
|