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.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. STEP_NUM_ERROR = 2 | _PARAM_ERROR_MASK
  27. DEBUGGER_CONDITION_UNAVAILABLE_ERROR = 3 | _PARAM_ERROR_MASK
  28. NODE_NOT_IN_GRAPH_ERROR = 0 | _DEBUGGER_GRAPH_ERROR
  29. GRAPH_NOT_EXIST_ERROR = 1 | _DEBUGGER_GRAPH_ERROR
  30. CREATE_WATCHPOINT_ERROR = 0 | _DEBUGGER_RUNNING_ERROR
  31. UPDATE_WATCHPOINT_ERROR = 1 | _DEBUGGER_RUNNING_ERROR
  32. DELETE_WATCHPOINT_ERROR = 2 | _DEBUGGER_RUNNING_ERROR
  33. CONTINUE_ERROR = 3 | _DEBUGGER_RUNNING_ERROR
  34. PAUSE_ERROR = 4 | _DEBUGGER_RUNNING_ERROR
  35. COMPARE_TENSOR_ERROR = 5 | _DEBUGGER_RUNNING_ERROR
  36. RECHECK_ERROR = 6 | _DEBUGGER_RUNNING_ERROR
  37. TENSOR_GRAPH_ERROR = 7 | _DEBUGGER_RUNNING_ERROR
  38. TENSOR_HIT_ERROR = 8 | _DEBUGGER_RUNNING_ERROR
  39. SET_RECOMMEND_WATCHPOINT_ERROR = 9 | _DEBUGGER_RUNNING_ERROR
  40. @unique
  41. class DebuggerErrorMsg(Enum):
  42. """Debugger error messages."""
  43. PARAM_TYPE_ERROR = "TypeError. {}"
  44. PARAM_VALUE_ERROR = "ValueError. {}"
  45. DEBUGGER_CONDITION_UNAVAILABLE_ERROR = "Condition is unavailable. {}"
  46. GRAPH_NOT_EXIST_ERROR = "The graph does not exist."
  47. CREATE_WATCHPOINT_ERROR = "Create watchpoint failed. {}"
  48. UPDATE_WATCHPOINT_ERROR = "Update watchpoint failed. {}"
  49. DELETE_WATCHPOINT_ERROR = "Delete watchpoint failed. {}"
  50. CONTINUE_ERROR = "Continue debugging failed. {}"
  51. PAUSE_ERROR = "Pause debugging failed. {}"
  52. RECHECK_ERROR = "Recheck failed. {}"
  53. TENSOR_GRAPH_ERROR = "Get tensor graphs failed."
  54. TENSOR_HIT_ERROR = "Get tensor hits failed."
  55. SET_RECOMMEND_WATCHPOINT_ERROR = "Set Recommend Watchpoints failed."