pw_presubmit: Fix OwnersError constructor

The previous OwnersError.__init__ stored the message argument in a
custom attribute rather than passing it to Exception.__init__. This
caused str() of the exception to be empty, (or more precisely, repr() to
show just the exception type name), leading to a confusing backtrace:

    20230405 21:07:40 ERR Presubmit check owners_lint_checks failed!
    Traceback (most recent call last):
      ...
      File ".../pw_presubmit/owners_checks.py", line 131, in __init__
	raise OwnersDependencyError(error_msg)
    pw_presubmit.owners_checks.OwnersDependencyError
                                                      ^^^???^^^

The use of Exception.message is obsolete:
https://stackoverflow.com/q/1272138

We can instead omit OwnersError.__init__ and use the base class
Exception.__init__ which accepts a message as the first argument.
This fixes the backtrace:

    20230406 15:11:15 ERR Presubmit check owners_lint_checks failed!
    Traceback (most recent call last):
      ...
      File ".../pw_presubmit/owners_checks.py", line 126, in __init__
	raise OwnersDependencyError(
    pw_presubmit.owners_checks.OwnersDependencyError: Tried to import
      .../OWNERS but it does not exist

This also required replacing `err.message` with `str(err)` -- or
just `err` if it is being formatted with `%s`.

Also fixed a typo: "exists" -> "exist".

Tested: Ran `pw presubmit --step owners_lint_checks` on a repo with a
  missing OWNERS file, and confirmed that the error message which was
  previously missing is now visible.
Change-Id: I94301255b1b0360aa9efb8d9f6f93b5f7d5f3639
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/137550
Pigweed-Auto-Submit: Jonathon Reinhart <jrreinhart@google.com>
Reviewed-by: Tim Laurence <timlaurence@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
1 file changed
tree: 16a0ed7042e9babe6429ec7355a3d8c3e0ced8ca
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. pw_alignment/
  7. pw_allocator/
  8. pw_analog/
  9. pw_android_toolchain/
  10. pw_arduino_build/
  11. pw_assert/
  12. pw_assert_basic/
  13. pw_assert_log/
  14. pw_assert_tokenized/
  15. pw_assert_zephyr/
  16. pw_async/
  17. pw_async_basic/
  18. pw_base64/
  19. pw_bloat/
  20. pw_blob_store/
  21. pw_bluetooth/
  22. pw_bluetooth_hci/
  23. pw_bluetooth_profiles/
  24. pw_boot/
  25. pw_boot_cortex_m/
  26. pw_build/
  27. pw_build_info/
  28. pw_build_mcuxpresso/
  29. pw_bytes/
  30. pw_checksum/
  31. pw_chrono/
  32. pw_chrono_embos/
  33. pw_chrono_freertos/
  34. pw_chrono_stl/
  35. pw_chrono_threadx/
  36. pw_chrono_zephyr/
  37. pw_cli/
  38. pw_compilation_testing/
  39. pw_console/
  40. pw_containers/
  41. pw_cpu_exception/
  42. pw_cpu_exception_cortex_m/
  43. pw_crypto/
  44. pw_digital_io/
  45. pw_docgen/
  46. pw_doctor/
  47. pw_env_setup/
  48. pw_file/
  49. pw_function/
  50. pw_fuzzer/
  51. pw_hdlc/
  52. pw_hex_dump/
  53. pw_i2c/
  54. pw_i2c_mcuxpresso/
  55. pw_ide/
  56. pw_interrupt/
  57. pw_interrupt_cortex_m/
  58. pw_interrupt_zephyr/
  59. pw_intrusive_ptr/
  60. pw_kvs/
  61. pw_libc/
  62. pw_log/
  63. pw_log_android/
  64. pw_log_basic/
  65. pw_log_null/
  66. pw_log_rpc/
  67. pw_log_string/
  68. pw_log_tokenized/
  69. pw_log_zephyr/
  70. pw_malloc/
  71. pw_malloc_freelist/
  72. pw_metric/
  73. pw_minimal_cpp_stdlib/
  74. pw_module/
  75. pw_multisink/
  76. pw_package/
  77. pw_perf_test/
  78. pw_persistent_ram/
  79. pw_polyfill/
  80. pw_preprocessor/
  81. pw_presubmit/
  82. pw_protobuf/
  83. pw_protobuf_compiler/
  84. pw_random/
  85. pw_result/
  86. pw_ring_buffer/
  87. pw_router/
  88. pw_rpc/
  89. pw_rust/
  90. pw_snapshot/
  91. pw_software_update/
  92. pw_span/
  93. pw_spi/
  94. pw_status/
  95. pw_stm32cube_build/
  96. pw_stream/
  97. pw_string/
  98. pw_symbolizer/
  99. pw_sync/
  100. pw_sync_baremetal/
  101. pw_sync_embos/
  102. pw_sync_freertos/
  103. pw_sync_stl/
  104. pw_sync_threadx/
  105. pw_sync_zephyr/
  106. pw_sys_io/
  107. pw_sys_io_arduino/
  108. pw_sys_io_baremetal_lm3s6965evb/
  109. pw_sys_io_baremetal_stm32f429/
  110. pw_sys_io_emcraft_sf2/
  111. pw_sys_io_mcuxpresso/
  112. pw_sys_io_pico/
  113. pw_sys_io_stdio/
  114. pw_sys_io_stm32cube/
  115. pw_sys_io_zephyr/
  116. pw_system/
  117. pw_target_runner/
  118. pw_thread/
  119. pw_thread_embos/
  120. pw_thread_freertos/
  121. pw_thread_stl/
  122. pw_thread_threadx/
  123. pw_thread_zephyr/
  124. pw_tls_client/
  125. pw_tls_client_boringssl/
  126. pw_tls_client_mbedtls/
  127. pw_tokenizer/
  128. pw_tool/
  129. pw_toolchain/
  130. pw_trace/
  131. pw_trace_tokenized/
  132. pw_transfer/
  133. pw_unit_test/
  134. pw_varint/
  135. pw_watch/
  136. pw_web/
  137. pw_work_queue/
  138. seed/
  139. targets/
  140. third_party/
  141. ts/
  142. zephyr/
  143. .bazelignore
  144. .bazelrc
  145. .black.toml
  146. .clang-format
  147. .clang-tidy
  148. .eslintrc.json
  149. .git-blame-ignore-revs
  150. .gitattributes
  151. .gitignore
  152. .gn
  153. .mypy.ini
  154. .prettierrc.js
  155. .pw_ide.yaml
  156. .pylintrc
  157. activate.bat
  158. Android.bp
  159. AUTHORS
  160. bootstrap.bat
  161. bootstrap.sh
  162. BUILD.bazel
  163. BUILD.gn
  164. BUILDCONFIG.gn
  165. CMakeLists.txt
  166. jest.config.ts
  167. Kconfig.zephyr
  168. LICENSE
  169. modules.gni
  170. OWNERS
  171. package-lock.json
  172. package.json
  173. pigweed.json
  174. PIGWEED_MODULES
  175. README.md
  176. rollup.config.js
  177. tsconfig.json
  178. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links