xref: /aosp_15_r20/external/executorch/exir/tests/test_error.py (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2# All rights reserved.
3#
4# This source code is licensed under the BSD-style license found in the
5# LICENSE file in the root directory of this source tree.
6
7# pyre-strict
8import unittest
9
10from executorch.exir.error import ExportError, ExportErrorType
11
12
13class TestError(unittest.TestCase):
14    def test_export_error_message(self) -> None:
15        def throws_err() -> None:
16            raise ExportError(ExportErrorType.NOT_SUPPORTED, "error message")
17
18        with self.assertRaisesRegex(ExportError, "[ExportErrorType.NOT_SUPPORTED]"):
19            throws_err()
20