github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/common/apperr/types.go (about)

     1  // This file is part of the Smart Home
     2  // Program complex distribution https://github.com/e154/smart-home
     3  // Copyright (C) 2016-2023, Filippov Alex
     4  //
     5  // This library is free software: you can redistribute it and/or
     6  // modify it under the terms of the GNU Lesser General Public
     7  // License as published by the Free Software Foundation; either
     8  // version 3 of the License, or (at your option) any later version.
     9  //
    10  // This library is distributed in the hope that it will be useful,
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13  // Library General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU Lesser General Public
    16  // License along with this library.  If not, see
    17  // <https://www.gnu.org/licenses/>.
    18  
    19  package apperr
    20  
    21  import (
    22  	"errors"
    23  )
    24  
    25  var (
    26  	ErrInternal        = errors.New("internal error")
    27  	ErrAlreadyExists   = errors.New("already exists")
    28  	ErrNotAllowed      = errors.New("not allowed")
    29  	ErrNotFound        = errors.New("not found")
    30  	ErrInvalidArgument = errors.New("invalid argument")
    31  	ErrInvalidRequest  = errors.New("invalid request")
    32  	ErrUnauthorized    = errors.New("unauthorized")
    33  	ErrUnknownField    = errors.New("unknown field")
    34  	ErrBadJSONRequest  = errors.New("bad JSON request")
    35  	ErrAccessDenied    = errors.New("access denied")
    36  	ErrAccessForbidden = errors.New("access forbidden")
    37  )
    38  
    39  var (
    40  	ErrUnimplemented              = errors.New("unimplemented")
    41  	ErrPassNotValid               = errors.New("password not valid")
    42  	ErrAccountIsBlocked           = errors.New("account is blocked")
    43  	ErrTokenIsDeprecated          = errors.New("token is deprecated")
    44  	ErrBadLoginOrPassword         = errors.New("bad login or password")
    45  	ErrMqttServerNoWorked         = errors.New("mqtt server not worked")
    46  	ErrBadRequestParams           = errors.New("bad request params")
    47  	ErrBadActorSettingsParameters = errors.New("bad actor settings parameters")
    48  	ErrTimeout                    = errors.New("timeout")
    49  	ErrProviderIsEmpty            = errors.New("provider is empty")
    50  	ErrBadSettings                = errors.New("there are no settings or the parameters are incorrectly set")
    51  )
    52  
    53  var (
    54  	ErrValidation        = ErrorWithCode("VALIDATION_ERROR", "one or more fields not valid", ErrInvalidRequest)
    55  	ErrInvalidExpiration = ErrorWithCode("INVALID_EXPIRATION", "invalid expiration", ErrInvalidRequest)
    56  	ErrOAuthAccessDenied = ErrorWithCode("ACCESS_DENIED", "client_id or secret not valid", ErrAccessDenied)
    57  
    58  	ErrDashboardImport   = ErrorWithCode("DASHBOARD_IMPORT_ERROR", "failed to import dashboard", ErrInternal)
    59  	ErrDashboardAdd      = ErrorWithCode("DASHBOARD_ADD_ERROR", "failed to add dashboard", ErrInternal)
    60  	ErrDashboardGet      = ErrorWithCode("DASHBOARD_GET_ERROR", "failed to get dashboard", ErrInternal)
    61  	ErrDashboardList     = ErrorWithCode("DASHBOARD_LIST_ERROR", "failed to list dashboard", ErrInternal)
    62  	ErrDashboardNotFound = ErrorWithCode("DASHBOARD_NOT_FOUND_ERROR", "dashboard is not found", ErrNotFound)
    63  	ErrDashboardUpdate   = ErrorWithCode("DASHBOARD_UPDATE_ERROR", "failed to update dashboard", ErrInternal)
    64  	ErrDashboardDelete   = ErrorWithCode("DASHBOARD_DELETE_ERROR", "failed to delete dashboard", ErrInternal)
    65  	ErrDashboardSearch   = ErrorWithCode("DASHBOARD_SEARCH_ERROR", "failed to search dashboard", ErrInternal)
    66  
    67  	ErrDashboardCardAdd      = ErrorWithCode("DASHBOARD_CARD_ADD_ERROR", "failed to add dashboard card", ErrInternal)
    68  	ErrDashboardCardGet      = ErrorWithCode("DASHBOARD_CARD_GET_ERROR", "failed to get dashboard card", ErrInternal)
    69  	ErrDashboardCardList     = ErrorWithCode("DASHBOARD_CARD_LIST_ERROR", "failed to list dashboard card", ErrInternal)
    70  	ErrDashboardCardNotFound = ErrorWithCode("DASHBOARD_CARD_NOT_FOUND_ERROR", "dashboard card is not found", ErrNotFound)
    71  	ErrDashboardCardUpdate   = ErrorWithCode("DASHBOARD_CARD_UPDATE_ERROR", "failed to update dashboard card", ErrInternal)
    72  	ErrDashboardCardDelete   = ErrorWithCode("DASHBOARD_CARD_DELETE_ERROR", "failed to delete dashboard card", ErrInternal)
    73  
    74  	ErrDashboardCardItemAdd      = ErrorWithCode("DASHBOARD_CARD_ITEM_ADD_ERROR", "failed to add dashboard card item", ErrInternal)
    75  	ErrDashboardCardItemGet      = ErrorWithCode("DASHBOARD_CARD_ITEM_GET_ERROR", "failed to get dashboard card item", ErrInternal)
    76  	ErrDashboardCardItemList     = ErrorWithCode("DASHBOARD_CARD_ITEM_LIST_ERROR", "failed to list dashboard card item", ErrInternal)
    77  	ErrDashboardCardItemNotFound = ErrorWithCode("DASHBOARD_CARD_ITEM_NOT_FOUND_ERROR", "dashboard card item is not found", ErrNotFound)
    78  	ErrDashboardCardItemUpdate   = ErrorWithCode("DASHBOARD_CARD_ITEM_UPDATE_ERROR", "failed to update dashboard card item", ErrInternal)
    79  	ErrDashboardCardItemDelete   = ErrorWithCode("DASHBOARD_CARD_ITEM_DELETE_ERROR", "failed to delete dashboard card item", ErrInternal)
    80  
    81  	ErrDashboardTabAdd      = ErrorWithCode("DASHBOARD_TAB_ADD_ERROR", "failed to add dashboard tab", ErrInternal)
    82  	ErrDashboardTabGet      = ErrorWithCode("DASHBOARD_TAB_GET_ERROR", "failed to get dashboard tab", ErrInternal)
    83  	ErrDashboardTabList     = ErrorWithCode("DASHBOARD_TAB_LIST_ERROR", "failed to list dashboard tab", ErrInternal)
    84  	ErrDashboardTabNotFound = ErrorWithCode("DASHBOARD_TAB_NOT_FOUND_ERROR", "dashboard tab is not found", ErrNotFound)
    85  	ErrDashboardTabUpdate   = ErrorWithCode("DASHBOARD_TAB_UPDATE_ERROR", "failed to update dashboard tab", ErrInternal)
    86  	ErrDashboardTabDelete   = ErrorWithCode("DASHBOARD_TAB_DELETE_ERROR", "failed to delete dashboard tab", ErrInternal)
    87  
    88  	ErrActionAdd      = ErrorWithCode("ACTION_ADD_ERROR", "failed to add action", ErrInternal)
    89  	ErrActionGet      = ErrorWithCode("ACTION_GET_ERROR", "failed to get action", ErrInternal)
    90  	ErrActionUpdate   = ErrorWithCode("ACTION_UPDATE_ERROR", "failed to update action", ErrInternal)
    91  	ErrActionList     = ErrorWithCode("ACTION_LIST_ERROR", "failed to list action", ErrInternal)
    92  	ErrActionNotFound = ErrorWithCode("ACTION_NOT_FOUND_ERROR", "action is not found", ErrNotFound)
    93  	ErrActionDelete   = ErrorWithCode("ACTION_DELETE_ERROR", "failed to delete action", ErrInternal)
    94  	ErrActionSearch   = ErrorWithCode("ACTION_SEARCH_ERROR", "failed to search action", ErrInternal)
    95  
    96  	ErrEntityAdd          = ErrorWithCode("ENTITY_ADD_ERROR", "failed to add entity", ErrInternal)
    97  	ErrEntityGet          = ErrorWithCode("ENTITY_GET_ERROR", "failed to get entity", ErrInternal)
    98  	ErrEntityList         = ErrorWithCode("ENTITY_LIST_ERROR", "failed to list entity", ErrInternal)
    99  	ErrEntityNotFound     = ErrorWithCode("ENTITY_NOT_FOUND_ERROR", "entity is not found", ErrNotFound)
   100  	ErrEntityUpdate       = ErrorWithCode("ENTITY_UPDATE_ERROR", "failed to update entity", ErrInternal)
   101  	ErrEntityDelete       = ErrorWithCode("ENTITY_DELETE_ERROR", "failed to delete entity", ErrInternal)
   102  	ErrEntitySearch       = ErrorWithCode("ENTITY_SEARCH_ERROR", "failed to search entity", ErrInternal)
   103  	ErrEntityDeleteScript = ErrorWithCode("ENTITY_DELETE_SCRIPT_ERROR", "delete script failed", ErrInternal)
   104  	ErrEntityDeleteTag    = ErrorWithCode("ENTITY_DELETE_TAG_ERROR", "delete script failed", ErrInternal)
   105  
   106  	ErrAlexaIntentAdd      = ErrorWithCode("ALEXA_INTENT_ADD_ERROR", "failed to add intent", ErrInternal)
   107  	ErrAlexaIntentUpdate   = ErrorWithCode("ALEXA_INTENT_UPDATE_ERROR", "failed to update intent", ErrInternal)
   108  	ErrAlexaIntentGet      = ErrorWithCode("ALEXA_INTENT_GET_ERROR", "failed to get intent", ErrInternal)
   109  	ErrAlexaIntentDelete   = ErrorWithCode("ALEXA_INTENT_DELETE_ERROR", "failed to delete intent", ErrInternal)
   110  	ErrAlexaIntentNotFound = ErrorWithCode("ALEXA_INTENT_NOT_FOUND_ERROR", "intent is not found", ErrNotFound)
   111  
   112  	ErrAlexaSkillAdd      = ErrorWithCode("ALEXA_SKILL_ADD_ERROR", "failed to add skill", ErrInternal)
   113  	ErrAlexaSkillGet      = ErrorWithCode("ALEXA_SKILL_GET_ERROR", "failed to get skill", ErrInternal)
   114  	ErrAlexaSkillUpdate   = ErrorWithCode("ALEXA_SKILL_UPDATE_ERROR", "failed to update skill", ErrInternal)
   115  	ErrAlexaSkillList     = ErrorWithCode("ALEXA_SKILL_LIST_ERROR", "failed to list skill", ErrInternal)
   116  	ErrAlexaSkillNotFound = ErrorWithCode("ALEXA_SKILL_NOT_FOUND_ERROR", "skill is not found", ErrNotFound)
   117  	ErrAlexaSkillDelete   = ErrorWithCode("ALEXA_SKILL_DELETE_ERROR", "failed to delete skill", ErrInternal)
   118  
   119  	ErrAreaAdd      = ErrorWithCode("AREA_ADD_ERROR", "failed to add area", ErrInternal)
   120  	ErrAreaGet      = ErrorWithCode("AREA_GET_ERROR", "failed to get area", ErrInternal)
   121  	ErrAreaUpdate   = ErrorWithCode("AREA_UPDATE_ERROR", "failed to update area", ErrInternal)
   122  	ErrAreaList     = ErrorWithCode("AREA_LIST_ERROR", "failed to list area", ErrInternal)
   123  	ErrAreaNotFound = ErrorWithCode("AREA_NOT_FOUND_ERROR", "area is not found", ErrNotFound)
   124  	ErrAreaDelete   = ErrorWithCode("AREA_DELETE_ERROR", "failed to delete area", ErrInternal)
   125  	ErrAreaClean    = ErrorWithCode("AREA_CLEAN_ERROR", "failed to clean area", ErrInternal)
   126  
   127  	ErrConditionAdd      = ErrorWithCode("CONDITION_ADD_ERROR", "failed to add condition", ErrInternal)
   128  	ErrConditionGet      = ErrorWithCode("CONDITION_GET_ERROR", "failed to get condition", ErrInternal)
   129  	ErrConditionUpdate   = ErrorWithCode("CONDITION_UPDATE_ERROR", "failed to update condition", ErrInternal)
   130  	ErrConditionList     = ErrorWithCode("CONDITION_LIST_ERROR", "failed to list condition", ErrInternal)
   131  	ErrConditionNotFound = ErrorWithCode("CONDITION_NOT_FOUND_ERROR", "condition is not found", ErrNotFound)
   132  	ErrConditionDelete   = ErrorWithCode("CONDITION_DELETE_ERROR", "failed to delete condition", ErrInternal)
   133  	ErrConditionSearch   = ErrorWithCode("CONDITION_SEARCH_ERROR", "failed to search condition", ErrInternal)
   134  
   135  	ErrEntityActionAdd      = ErrorWithCode("ENTITY_ACTION_ADD_ERROR", "failed to add action", ErrInternal)
   136  	ErrEntityActionGet      = ErrorWithCode("ENTITY_ACTION_GET_ERROR", "failed to get action", ErrInternal)
   137  	ErrEntityActionUpdate   = ErrorWithCode("ENTITY_ACTION_UPDATE_ERROR", "failed to update action", ErrInternal)
   138  	ErrEntityActionList     = ErrorWithCode("ENTITY_ACTION_LIST_ERROR", "failed to list action", ErrInternal)
   139  	ErrEntityActionNotFound = ErrorWithCode("ENTITY_ACTION_NOT_FOUND_ERROR", "action is not found", ErrNotFound)
   140  	ErrEntityActionDelete   = ErrorWithCode("ENTITY_ACTION_DELETE_ERROR", "failed to delete action", ErrInternal)
   141  
   142  	ErrEntityStateAdd      = ErrorWithCode("ENTITY_STATE_ADD_ERROR", "failed to add state", ErrInternal)
   143  	ErrEntityStateGet      = ErrorWithCode("ENTITY_STATE_GET_ERROR", "failed to get state", ErrInternal)
   144  	ErrEntityStateUpdate   = ErrorWithCode("ENTITY_STATE_UPDATE_ERROR", "failed to update state", ErrInternal)
   145  	ErrEntityStateList     = ErrorWithCode("ENTITY_STATE_LIST_ERROR", "failed to list state", ErrInternal)
   146  	ErrEntityStateNotFound = ErrorWithCode("ENTITY_STATE_NOT_FOUND_ERROR", "state is not found", ErrNotFound)
   147  	ErrEntityStateDelete   = ErrorWithCode("ENTITY_STATE_DELETE_ERROR", "failed to delete state", ErrInternal)
   148  
   149  	ErrEntityStorageAdd    = ErrorWithCode("ENTITY_STORAGE_ADD_ERROR", "failed to add storage", ErrInternal)
   150  	ErrEntityStorageGet    = ErrorWithCode("ENTITY_STORAGE_GET_ERROR", "failed to get storage", ErrInternal)
   151  	ErrEntityStorageList   = ErrorWithCode("ENTITY_STORAGE_LIST_ERROR", "failed to list storage", ErrInternal)
   152  	ErrEntityStorageDelete = ErrorWithCode("ENTITY_STORAGE_DELETE_ERROR", "failed to delete storage", ErrInternal)
   153  
   154  	ErrEntityStat = ErrorWithCode("ENTITY_STAT_ERROR", "failed to get entity statistic", ErrInternal)
   155  
   156  	ErrImageAdd      = ErrorWithCode("IMAGE_ADD_ERROR", "failed to add image", ErrInternal)
   157  	ErrImageGet      = ErrorWithCode("IMAGE_GET_ERROR", "failed to get image", ErrInternal)
   158  	ErrImageUpdate   = ErrorWithCode("IMAGE_UPDATE_ERROR", "failed to update image", ErrInternal)
   159  	ErrImageList     = ErrorWithCode("IMAGE_LIST_ERROR", "failed to list image", ErrInternal)
   160  	ErrImageNotFound = ErrorWithCode("IMAGE_NOT_FOUND_ERROR", "image is not found", ErrNotFound)
   161  	ErrImageDelete   = ErrorWithCode("IMAGE_DELETE_ERROR", "failed to delete image", ErrInternal)
   162  
   163  	ErrLogAdd      = ErrorWithCode("LOG_ADD_ERROR", "failed to add log", ErrInternal)
   164  	ErrLogGet      = ErrorWithCode("LOG_GET_ERROR", "failed to get log", ErrInternal)
   165  	ErrLogList     = ErrorWithCode("LOG_LIST_ERROR", "failed to list log", ErrInternal)
   166  	ErrLogNotFound = ErrorWithCode("LOG_NOT_FOUND_ERROR", "log is not found", ErrNotFound)
   167  	ErrLogDelete   = ErrorWithCode("LOG_DELETE_ERROR", "failed to delete log", ErrNotFound)
   168  
   169  	ErrMessageAdd              = ErrorWithCode("MESSAGE_ADD_ERROR", "failed to add message", ErrInternal)
   170  	ErrMessageDeliveryAdd      = ErrorWithCode("MESSAGE_DELIVERY_ADD_ERROR", "failed to add message delivery", ErrInternal)
   171  	ErrMessageDeliveryList     = ErrorWithCode("MESSAGE_DELIVERY_LIST_ERROR", "failed to list message delivery", ErrInternal)
   172  	ErrMessageDeliveryUpdate   = ErrorWithCode("MESSAGE_DELIVERY_UPDATE_ERROR", "failed to update message delivery", ErrInternal)
   173  	ErrMessageDeliveryDelete   = ErrorWithCode("MESSAGE_DELIVERY_DELETE_ERROR", "failed to delete message delivery", ErrInternal)
   174  	ErrMessageDeliveryGet      = ErrorWithCode("MESSAGE_DELIVERY_GET_ERROR", "failed to get message delivery", ErrInternal)
   175  	ErrMessageDeliveryNotFound = ErrorWithCode("MESSAGE_DELIVERY_NOT_FOUND_ERROR", "message delivery is not found", ErrNotFound)
   176  
   177  	ErrMetricAdd      = ErrorWithCode("METRIC_ADD_ERROR", "failed to add metric", ErrInternal)
   178  	ErrMetricGet      = ErrorWithCode("METRIC_GET_ERROR", "failed to get metric", ErrInternal)
   179  	ErrMetricUpdate   = ErrorWithCode("METRIC_UPDATE_ERROR", "failed to update metric", ErrInternal)
   180  	ErrMetricList     = ErrorWithCode("METRIC_LIST_ERROR", "failed to list metric", ErrInternal)
   181  	ErrMetricNotFound = ErrorWithCode("METRIC_NOT_FOUND_ERROR", "metric is not found", ErrNotFound)
   182  	ErrMetricDelete   = ErrorWithCode("METRIC_DELETE_ERROR", "failed to delete metric", ErrInternal)
   183  	ErrMetricSearch   = ErrorWithCode("METRIC_SEARCH_ERROR", "failed to search metric", ErrInternal)
   184  
   185  	ErrMetricBucketAdd    = ErrorWithCode("METRIC_BUCKET_ADD_ERROR", "failed to add metric backet", ErrInternal)
   186  	ErrMetricBucketGet    = ErrorWithCode("METRIC_BUCKET_GET_ERROR", "failed to get metric backet", ErrInternal)
   187  	ErrMetricBucketDelete = ErrorWithCode("METRIC_BUCKET_DELETE_ERROR", "failed to delete metric backet", ErrInternal)
   188  
   189  	ErrPermissionAdd    = ErrorWithCode("PERMISSION_ADD_ERROR", "failed to add permission", ErrInternal)
   190  	ErrPermissionGet    = ErrorWithCode("PERMISSION_GET_ERROR", "failed to get permission", ErrInternal)
   191  	ErrPermissionDelete = ErrorWithCode("PERMISSION_DELETE_ERROR", "failed to delete permission", ErrInternal)
   192  
   193  	ErrPluginAdd        = ErrorWithCode("PLUGIN_ADD_ERROR", "failed to add plugin", ErrInternal)
   194  	ErrPluginGet        = ErrorWithCode("PLUGIN_GET_ERROR", "failed to get plugin", ErrInternal)
   195  	ErrPluginUpdate     = ErrorWithCode("PLUGIN_UPDATE_ERROR", "failed to update plugin", ErrInternal)
   196  	ErrPluginList       = ErrorWithCode("PLUGIN_LIST_ERROR", "failed to list plugin", ErrInternal)
   197  	ErrPluginNotFound   = ErrorWithCode("PLUGIN_NOT_FOUND_ERROR", "plugin is not found", ErrNotFound)
   198  	ErrPluginDelete     = ErrorWithCode("PLUGIN_DELETE_ERROR", "failed to delete plugin", ErrInternal)
   199  	ErrPluginSearch     = ErrorWithCode("PLUGIN_SEARCH_ERROR", "failed to search plugin", ErrInternal)
   200  	ErrPluginIsLoaded   = ErrorWithCode("PLUGIN_IS_LOADED", "plugin is loaded", ErrInvalidRequest)
   201  	ErrPluginIsUnloaded = ErrorWithCode("PLUGIN_IS_UNLOADED", "plugin is unloaded", ErrInvalidRequest)
   202  	ErrPluginNotLoaded  = ErrorWithCode("PLUGIN_NOT_LOADED", "plugin not loaded", ErrInvalidRequest)
   203  
   204  	ErrRoleAdd             = ErrorWithCode("ROLE_ADD_ERROR", "failed to add role", ErrInternal)
   205  	ErrRoleGet             = ErrorWithCode("ROLE_GET_ERROR", "failed to get role", ErrInternal)
   206  	ErrRoleUpdate          = ErrorWithCode("ROLE_UPDATE_ERROR", "failed to update role", ErrInternal)
   207  	ErrRoleUpdateForbidden = ErrorWithCode("ROLE_UPDATE_ERROR", "failed to update role", ErrAccessForbidden)
   208  	ErrRoleList            = ErrorWithCode("ROLE_LIST_ERROR", "failed to list role", ErrInternal)
   209  	ErrRoleNotFound        = ErrorWithCode("ROLE_NOT_FOUND_ERROR", "role is not found", ErrNotFound)
   210  	ErrRoleDelete          = ErrorWithCode("ROLE_DELETE_ERROR", "failed to delete role", ErrInternal)
   211  	ErrRoleDeleteForbidden = ErrorWithCode("ROLE_DELETE_ERROR", "failed to delete role", ErrAccessForbidden)
   212  	ErrRoleSearch          = ErrorWithCode("ROLE_SEARCH_ERROR", "failed to search role", ErrInternal)
   213  
   214  	ErrRunStoryAdd    = ErrorWithCode("RUN_STORY_ADD_ERROR", "failed to add run story", ErrInternal)
   215  	ErrRunStoryUpdate = ErrorWithCode("RUN_STORY_UPDATE_ERROR", "failed to update run story", ErrInternal)
   216  	ErrRunStoryList   = ErrorWithCode("RUN_STORY_LIST_ERROR", "failed to list run story", ErrInternal)
   217  
   218  	ErrScriptAdd      = ErrorWithCode("SCRIPT_ADD_ERROR", "failed to add script", ErrInternal)
   219  	ErrScriptGet      = ErrorWithCode("SCRIPT_GET_ERROR", "failed to get script", ErrInternal)
   220  	ErrScriptUpdate   = ErrorWithCode("SCRIPT_UPDATE_ERROR", "failed to update script", ErrInternal)
   221  	ErrScriptList     = ErrorWithCode("SCRIPT_LIST_ERROR", "failed to list script", ErrInternal)
   222  	ErrScriptNotFound = ErrorWithCode("SCRIPT_NOT_FOUND_ERROR", "script is not found", ErrNotFound)
   223  	ErrScriptDelete   = ErrorWithCode("SCRIPT_DELETE_ERROR", "failed to delete script", ErrInternal)
   224  	ErrScriptSearch   = ErrorWithCode("SCRIPT_SEARCH_ERROR", "failed to search script", ErrInternal)
   225  	ErrScriptStat     = ErrorWithCode("SCRIPT_STAT_ERROR", "failed to get script statistic", ErrInternal)
   226  	ErrScriptCompile  = ErrorWithCode("SCRIPT_COMPILE_ERROR", "failed to compile script", ErrInternal)
   227  
   228  	ErrTagSearch   = ErrorWithCode("TAG_SEARCH_ERROR", "failed to search tag", ErrInternal)
   229  	ErrTagDelete   = ErrorWithCode("TAG_DELETE_ERROR", "failed to delete tag", ErrInternal)
   230  	ErrTagAdd      = ErrorWithCode("TAG_ADD_ERROR", "failed to add tag", ErrInternal)
   231  	ErrTagList     = ErrorWithCode("TAG_LIST_ERROR", "failed to list tag", ErrInternal)
   232  	ErrTagNotFound = ErrorWithCode("TAG_NOT_FOUND_ERROR", "tag is not found", ErrInternal)
   233  	ErrTagGet      = ErrorWithCode("TAG_GET_ERROR", "failed to get tag", ErrInternal)
   234  	ErrTagUpdate   = ErrorWithCode("TAG_UPDATE_ERROR", "failed to update tag", ErrInternal)
   235  
   236  	ErrTaskAdd             = ErrorWithCode("TASK_ADD_ERROR", "failed to add Task", ErrInternal)
   237  	ErrTaskGet             = ErrorWithCode("TASK_GET_ERROR", "failed to get Task", ErrInternal)
   238  	ErrTaskUpdate          = ErrorWithCode("TASK_UPDATE_ERROR", "failed to update Task", ErrInternal)
   239  	ErrTaskList            = ErrorWithCode("TASK_LIST_ERROR", "failed to list Task", ErrInternal)
   240  	ErrTaskNotFound        = ErrorWithCode("TASK_NOT_FOUND_ERROR", "Task is not found", ErrNotFound)
   241  	ErrTaskDelete          = ErrorWithCode("TASK_DELETE_ERROR", "failed to delete Task", ErrInternal)
   242  	ErrTaskSearch          = ErrorWithCode("TASK_SEARCH_ERROR", "failed to search Task", ErrInternal)
   243  	ErrTaskDeleteTrigger   = ErrorWithCode("TASK_DELETE_TRIGGER_ERROR", "task delete trigger failed", ErrInternal)
   244  	ErrTaskDeleteCondition = ErrorWithCode("TASK_DELETE_CONDITION_ERROR", "task delete condition failed", ErrInternal)
   245  	ErrTaskDeleteAction    = ErrorWithCode("TASK_DELETE_ACTION_ERROR", "task delete action failed", ErrInternal)
   246  
   247  	ErrChatAdd    = ErrorWithCode("CHAT_ADD_ERROR", "failed to add chat", ErrInternal)
   248  	ErrChatList   = ErrorWithCode("CHAT_LIST_ERROR", "failed to list chat", ErrInternal)
   249  	ErrChatDelete = ErrorWithCode("CHAT_DELETE_ERROR", "failed to delete chat", ErrInternal)
   250  
   251  	ErrTemplateAdd      = ErrorWithCode("TEMPLATE_ADD_ERROR", "failed to add template", ErrInternal)
   252  	ErrTemplateGet      = ErrorWithCode("TEMPLATE_GET_ERROR", "failed to get template", ErrInternal)
   253  	ErrTemplateUpdate   = ErrorWithCode("TEMPLATE_UPDATE_ERROR", "failed to update template", ErrInternal)
   254  	ErrTemplateList     = ErrorWithCode("TEMPLATE_LIST_ERROR", "failed to list template", ErrInternal)
   255  	ErrTemplateNotFound = ErrorWithCode("TEMPLATE_NOT_FOUND_ERROR", "template is not found", ErrNotFound)
   256  	ErrTemplateDelete   = ErrorWithCode("TEMPLATE_DELETE_ERROR", "failed to delete template", ErrInternal)
   257  	ErrTemplateSearch   = ErrorWithCode("TEMPLATE_SEARCH_ERROR", "failed to search template", ErrInternal)
   258  
   259  	ErrTriggerAdd          = ErrorWithCode("TRIGGER_ADD_ERROR", "failed to add trigger", ErrInternal)
   260  	ErrTriggerGet          = ErrorWithCode("TRIGGER_GET_ERROR", "failed to get trigger", ErrInternal)
   261  	ErrTriggerUpdate       = ErrorWithCode("TRIGGER_UPDATE_ERROR", "failed to update trigger", ErrInternal)
   262  	ErrTriggerList         = ErrorWithCode("TRIGGER_LIST_ERROR", "failed to list trigger", ErrInternal)
   263  	ErrTriggerNotFound     = ErrorWithCode("TRIGGER_NOT_FOUND_ERROR", "trigger is not found", ErrNotFound)
   264  	ErrTriggerDelete       = ErrorWithCode("TRIGGER_DELETE_ERROR", "failed to delete trigger", ErrInternal)
   265  	ErrTriggerSearch       = ErrorWithCode("TRIGGER_SEARCH_ERROR", "failed to search trigger", ErrInternal)
   266  	ErrTriggerDeleteEntity = ErrorWithCode("TRIGGER_DELETE_ENTITY_ERROR", "trigger delete entity failed", ErrInternal)
   267  
   268  	ErrUserAdd             = ErrorWithCode("USER_ADD_ERROR", "failed to add user", ErrInternal)
   269  	ErrUserMetaAdd         = ErrorWithCode("USER_META_ADD_ERROR", "failed to add user meta", ErrInternal)
   270  	ErrUserGet             = ErrorWithCode("USER_GET_ERROR", "failed to get user", ErrInternal)
   271  	ErrUserUpdate          = ErrorWithCode("USER_UPDATE_ERROR", "failed to update user", ErrInternal)
   272  	ErrUserUpdateForbidden = ErrorWithCode("USER_UPDATE_ERROR", "failed to update user", ErrAccessForbidden)
   273  	ErrUserList            = ErrorWithCode("USER_LIST_ERROR", "failed to list user", ErrInternal)
   274  	ErrUserNotFound        = ErrorWithCode("USER_NOT_FOUND_ERROR", "user is not found", ErrNotFound)
   275  	ErrUserDelete          = ErrorWithCode("USER_DELETE_ERROR", "failed to delete user", ErrInternal)
   276  	ErrUserDeleteForbidden = ErrorWithCode("USER_DELETE_ERROR", "failed to delete user", ErrAccessForbidden)
   277  
   278  	ErrVariableAdd             = ErrorWithCode("VARIABLE_ADD_ERROR", "failed to add variable", ErrInternal)
   279  	ErrVariableGet             = ErrorWithCode("VARIABLE_GET_ERROR", "failed to get variable", ErrInternal)
   280  	ErrVariableUpdate          = ErrorWithCode("VARIABLE_UPDATE_ERROR", "failed to update variable", ErrInternal)
   281  	ErrVariableList            = ErrorWithCode("VARIABLE_LIST_ERROR", "failed to list variable", ErrInternal)
   282  	ErrVariableNotFound        = ErrorWithCode("VARIABLE_NOT_FOUND_ERROR", "variable is not found", ErrNotFound)
   283  	ErrVariableDelete          = ErrorWithCode("VARIABLE_DELETE_ERROR", "failed to delete variable", ErrInternal)
   284  	ErrVariableUpdateForbidden = ErrorWithCode("VARIABLE_UPDATE_ERROR", "unable to update system variable", ErrAccessForbidden)
   285  	ErrVariableDeleteTag       = ErrorWithCode("VARIABLE_DELETE_TAG_ERROR", "delete script failed", ErrInternal)
   286  
   287  	ErrZigbee2mqttAdd      = ErrorWithCode("ZIGBEE2MQTT_ADD_ERROR", "failed to add zigbee2mqtt", ErrInternal)
   288  	ErrZigbee2mqttGet      = ErrorWithCode("ZIGBEE2MQTT_GET_ERROR", "failed to get zigbee2mqtt", ErrInternal)
   289  	ErrZigbee2mqttUpdate   = ErrorWithCode("ZIGBEE2MQTT_UPDATE_ERROR", "failed to update zigbee2mqtt", ErrInternal)
   290  	ErrZigbee2mqttList     = ErrorWithCode("ZIGBEE2MQTT_LIST_ERROR", "failed to list zigbee2mqtt", ErrInternal)
   291  	ErrZigbee2mqttNotFound = ErrorWithCode("ZIGBEE2MQTT_NOT_FOUND_ERROR", "zigbee2mqtt is not found", ErrNotFound)
   292  	ErrZigbee2mqttDelete   = ErrorWithCode("ZIGBEE2MQTT_DELETE_ERROR", "failed to delete zigbee2mqtt", ErrInternal)
   293  
   294  	ErrZigbeeDeviceAdd      = ErrorWithCode("ZIGBEE_DEVICE_ADD_ERROR", "failed to add device", ErrInternal)
   295  	ErrZigbeeDeviceGet      = ErrorWithCode("ZIGBEE_DEVICE_GET_ERROR", "failed to get device", ErrInternal)
   296  	ErrZigbeeDeviceUpdate   = ErrorWithCode("ZIGBEE_DEVICE_UPDATE_ERROR", "failed to update device", ErrInternal)
   297  	ErrZigbeeDeviceList     = ErrorWithCode("ZIGBEE_DEVICE_LIST_ERROR", "failed to list device", ErrInternal)
   298  	ErrZigbeeDeviceNotFound = ErrorWithCode("ZIGBEE_DEVICE_NOT_FOUND_ERROR", "device is not found", ErrNotFound)
   299  	ErrZigbeeDeviceDelete   = ErrorWithCode("ZIGBEE_DEVICE_DELETE_ERROR", "failed to delete device", ErrInternal)
   300  	ErrZigbeeDeviceSearch   = ErrorWithCode("ZIGBEE_DEVICE_SEARCH_ERROR", "failed to search device", ErrInternal)
   301  
   302  	ErrUserDeviceGet    = ErrorWithCode("USER_DEVICE_GET_ERROR", "failed to get device list", ErrInternal)
   303  	ErrUserDeviceDelete = ErrorWithCode("USER_DEVICE_DELETE_ERROR", "failed to delete user device", ErrInternal)
   304  	ErrUserDeviceAdd    = ErrorWithCode("USER_DEVICE_ADD_ERROR", "failed to add user device", ErrInternal)
   305  	ErrUserDeviceList   = ErrorWithCode("USER_DEVICE_LIST_ERROR", "failed to list user devices", ErrInternal)
   306  
   307  	ErrBackupNotFound           = ErrorWithCode("BACKUP_NOT_FOUND_ERROR", "backup not found", ErrNotFound)
   308  	ErrBackupNameNotUnique      = ErrorWithCode("BACKUP_NAME_NOT_UNIQUE_ERROR", "backup name not unique", ErrInvalidRequest)
   309  	ErrBackupRestoreForbidden   = ErrorWithCode("BACKUP_RESTORE_ERROR", "failed to restore backup", ErrAccessForbidden)
   310  	ErrBackupApplyForbidden     = ErrorWithCode("BACKUP_APPLY_ERROR", "failed to apply backup", ErrAccessForbidden)
   311  	ErrBackupRollbackForbidden  = ErrorWithCode("BACKUP_ROLLBACK_ERROR", "failed to rollback backup", ErrAccessForbidden)
   312  	ErrBackupCreateNewForbidden = ErrorWithCode("BACKUP_CREATE_ERROR", "failed to create new backup", ErrAccessForbidden)
   313  	ErrBackupUploadForbidden    = ErrorWithCode("BACKUP_UPLOAD_ERROR", "failed to upload backup", ErrAccessForbidden)
   314  
   315  	ErrScriptVersionAdd    = ErrorWithCode("SCRIPT_VERSION_ADD_ERROR", "failed to add script version", ErrInternal)
   316  	ErrScriptVersionList   = ErrorWithCode("SCRIPT_VERSION_LIST_ERROR", "failed to list script version", ErrInternal)
   317  	ErrScriptVersionDelete = ErrorWithCode("SCRIPT_VERSION_DELETE_ERROR", "failed to delete script version", ErrInternal)
   318  )