Register the error class name with the FFI core.
(mycls: type)
| 245 | name_or_cls = cls.__name__ |
| 246 | |
| 247 | def register(mycls: type) -> type: |
| 248 | """Register the error class name with the FFI core.""" |
| 249 | err_name = name_or_cls if isinstance(name_or_cls, str) else mycls.__name__ |
| 250 | core.ERROR_NAME_TO_TYPE[err_name] = mycls |
| 251 | core.ERROR_TYPE_TO_NAME[mycls] = err_name |
| 252 | return mycls |
| 253 | |
| 254 | if cls is None: |
| 255 | return register |