2020-10-15 20:23:49 +00:00
|
|
|
## Syntax
|
|
|
|
|
|
|
|
# Errors: not found
|
|
|
|
|
|
|
|
not_found = "Exception: There is no {type} `{name}`"
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def user_not_found_in_disk(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (192, not_found.format(type="user", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def role_not_found_in_disk(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (255, not_found.format(type="role", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def settings_profile_not_found_in_disk(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (180, not_found.format(type="settings profile", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def quota_not_found_in_disk(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (199, not_found.format(type="quota", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def row_policy_not_found_in_disk(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (11, not_found.format(type="row policy", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def table_does_not_exist(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (60, "Exception: Table {name} doesn't exist".format(name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
# Errors: cannot_rename
|
|
|
|
|
|
|
|
cannot_rename = "Exception: {type} `{name}`: cannot rename to `{name_new}` because {type} `{name_new}` already exists"
|
|
|
|
cannot_rename_exitcode = 237
|
|
|
|
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def cannot_rename_user(name, name_new):
|
|
|
|
return (
|
|
|
|
cannot_rename_exitcode,
|
|
|
|
cannot_rename.format(type="user", name=name, name_new=name_new),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def cannot_rename_role(name, name_new):
|
|
|
|
return (
|
|
|
|
cannot_rename_exitcode,
|
|
|
|
cannot_rename.format(type="role", name=name, name_new=name_new),
|
|
|
|
)
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def cannot_rename_settings_profile(name, name_new):
|
|
|
|
return (
|
|
|
|
cannot_rename_exitcode,
|
|
|
|
cannot_rename.format(type="settings profile", name=name, name_new=name_new),
|
|
|
|
)
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def cannot_rename_quota(name, name_new):
|
|
|
|
return (
|
|
|
|
cannot_rename_exitcode,
|
|
|
|
cannot_rename.format(type="quota", name=name, name_new=name_new),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def cannot_rename_row_policy(name, name_new):
|
|
|
|
return (
|
|
|
|
cannot_rename_exitcode,
|
|
|
|
cannot_rename.format(type="row policy", name=name, name_new=name_new),
|
|
|
|
)
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
# Errors: cannot insert
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
cannot_insert = (
|
|
|
|
"Exception: {type} `{name}`: cannot insert because {type} `{name}` already exists"
|
|
|
|
)
|
2020-10-15 20:23:49 +00:00
|
|
|
cannot_insert_exitcode = 237
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def cannot_insert_user(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (cannot_insert_exitcode, cannot_insert.format(type="user", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def cannot_insert_role(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (cannot_insert_exitcode, cannot_insert.format(type="role", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def cannot_insert_settings_profile(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (
|
|
|
|
cannot_insert_exitcode,
|
|
|
|
cannot_insert.format(type="settings profile", name=name),
|
|
|
|
)
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def cannot_insert_quota(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (cannot_insert_exitcode, cannot_insert.format(type="quota", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def cannot_insert_row_policy(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (cannot_insert_exitcode, cannot_insert.format(type="row policy", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
# Error: default is readonly
|
|
|
|
|
|
|
|
cannot_remove_default = "Exception: Cannot remove {type} `default` from users.xml because this storage is readonly"
|
|
|
|
cannot_remove_default_exitcode = 239
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def cannot_update_default():
|
2022-03-22 16:39:58 +00:00
|
|
|
return (
|
|
|
|
cannot_remove_default_exitcode,
|
|
|
|
"Exception: Cannot update user `default` in users.xml because this storage is readonly",
|
|
|
|
)
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def cannot_remove_user_default():
|
|
|
|
return (cannot_remove_default_exitcode, cannot_remove_default.format(type="user"))
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def cannot_remove_settings_profile_default():
|
2022-03-22 16:39:58 +00:00
|
|
|
return (
|
|
|
|
cannot_remove_default_exitcode,
|
|
|
|
cannot_remove_default.format(type="settings profile"),
|
|
|
|
)
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def cannot_remove_quota_default():
|
|
|
|
return (cannot_remove_default_exitcode, cannot_remove_default.format(type="quota"))
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
# Other syntax errors
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def unknown_setting(setting):
|
|
|
|
return (115, f"Exception: Unknown setting {setting}.")
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def cluster_not_found(cluster):
|
|
|
|
return (170, f"Exception: Requested cluster '{cluster}' not found.")
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
## Privileges
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def not_enough_privileges(name):
|
|
|
|
return (241, f"Exception: {name}: Not enough privileges.")
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def cannot_parse_string_as_float(string):
|
|
|
|
return (6, f"Exception: Cannot parse string '{string}' as Float64")
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def missing_columns(name):
|
|
|
|
return (47, f"Exception: Missing columns: '{name}' while processing query")
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
# Errors: wrong name
|
|
|
|
|
|
|
|
wrong_name = "Exception: Wrong {type} name. Cannot find {type} `{name}` to drop"
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def wrong_column_name(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (10, wrong_name.format(type="column", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def wrong_index_name(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (36, wrong_name.format(type="index", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
def wrong_constraint_name(name):
|
2022-03-22 16:39:58 +00:00
|
|
|
return (36, wrong_name.format(type="constraint", name=name))
|
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
|
|
|
|
# Errors: cannot add
|
|
|
|
|
|
|
|
cannot_add = "Exception: Cannot add index {name}: index with this name already exists"
|
|
|
|
cannot_add_exitcode = 44
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def cannot_add_index(name):
|
|
|
|
return (cannot_add_exitcode, cannot_add.format(name=name))
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-10-15 20:23:49 +00:00
|
|
|
def cannot_add_constraint(name):
|
|
|
|
return (cannot_add_exitcode, cannot_add.format(name=name))
|