You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

error_code.py 2.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """Debugger error code and messages."""
  16. from enum import Enum, unique
  17. from mindinsight.utils.constant import DebuggerErrors as DebuggerErrorCodes
  18. _PARAM_ERROR_MASK = 0b00001 << 7
  19. _DEBUGGER_GRAPH_ERROR = 0b00010 << 7
  20. _DEBUGGER_RUNNING_ERROR = 0b00011 << 7
  21. @unique
  22. class DebuggerErrors(DebuggerErrorCodes):
  23. """Debugger error codes."""
  24. PARAM_TYPE_ERROR = 0 | _PARAM_ERROR_MASK
  25. PARAM_VALUE_ERROR = 1 | _PARAM_ERROR_MASK
  26. NODE_NOT_IN_GRAPH_ERROR = 0 | _DEBUGGER_GRAPH_ERROR
  27. GRAPH_NOT_EXIST_ERROR = 1 | _DEBUGGER_GRAPH_ERROR
  28. CREATE_WATCHPOINT_ERROR = 0 | _DEBUGGER_RUNNING_ERROR
  29. UPDATE_WATCHPOINT_ERROR = 1 | _DEBUGGER_RUNNING_ERROR
  30. DELETE_WATCHPOINT_ERROR = 2 | _DEBUGGER_RUNNING_ERROR
  31. CONTINUE_ERROR = 3 | _DEBUGGER_RUNNING_ERROR
  32. PAUSE_ERROR = 4 | _DEBUGGER_RUNNING_ERROR
  33. COMPARE_TENSOR_ERROR = 5 | _DEBUGGER_RUNNING_ERROR
  34. RECHECK_ERROR = 6 | _DEBUGGER_RUNNING_ERROR
  35. @unique
  36. class DebuggerErrorMsg(Enum):
  37. """Debugger error messages."""
  38. PARAM_TYPE_ERROR = "TypeError. {}"
  39. PARAM_VALUE_ERROR = "ValueError. {}"
  40. GRAPH_NOT_EXIST_ERROR = "The graph does not exist."
  41. CREATE_WATCHPOINT_ERROR = "Create watchpoint failed. {}"
  42. UPDATE_WATCHPOINT_ERROR = "Update watchpoint failed. {}"
  43. DELETE_WATCHPOINT_ERROR = "Delete watchpoint failed. {}"
  44. CONTINUE_ERROR = "Continue debugging failed. {}"
  45. PAUSE_ERROR = "Pause debugging failed. {}"
  46. RECHECK_ERROR = "Recheck failed. {}"