75 lines
1.4 KiB
Crystal
75 lines
1.4 KiB
Crystal
module Backend::Api::Errors
|
|
UNKNOWN_PRIVATE_ERROR = "UNKNOWN_ERROR"
|
|
UNKNOWN_PUBLIC_ERROR = "UNKNOWN_PUBLIC_ERROR"
|
|
|
|
abstract class Error < Exception
|
|
abstract def api_message : String
|
|
end
|
|
|
|
abstract class PrivateError < Error
|
|
end
|
|
|
|
abstract class PublicError < Error
|
|
end
|
|
|
|
class SessionExpired < PublicError
|
|
def api_message : String
|
|
"Session expired"
|
|
end
|
|
end
|
|
|
|
class NotAuthenticated < PublicError
|
|
def api_message : String
|
|
"Not authenticated"
|
|
end
|
|
end
|
|
|
|
class Authentication < PublicError
|
|
def api_message : String
|
|
"Invalid username or password"
|
|
end
|
|
end
|
|
|
|
class InvalidPermissions < PublicError
|
|
def api_message : String
|
|
"Invalid permissions"
|
|
end
|
|
end
|
|
|
|
# class LdapUserDoesNotExist < PublicError
|
|
# def api_message : String
|
|
# "LDAP user does not exist"
|
|
# end
|
|
# end
|
|
|
|
class DuplicateTeachers < PublicError
|
|
def api_message : String
|
|
"Duplicate teachers"
|
|
end
|
|
end
|
|
|
|
class NotEnoughTeachers < PublicError
|
|
def api_message : String
|
|
"Not enough teachers"
|
|
end
|
|
end
|
|
|
|
# class TeachersNotRegistered < PublicError
|
|
# def api_message : String
|
|
# "Teachers not registered"
|
|
# end
|
|
# end
|
|
|
|
class VotingNotAllowed < PublicError
|
|
def api_message : String
|
|
"Voting not yet allowed"
|
|
end
|
|
end
|
|
|
|
class TeachersNotFound < PublicError
|
|
def api_message : String
|
|
"Teachers not found"
|
|
end
|
|
end
|
|
end
|