diff --git a/recurly/resource.py b/recurly/resource.py
index a3b671c..8677ab4 100644
--- a/recurly/resource.py
+++ b/recurly/resource.py
@@ -42,9 +42,13 @@ class Resource:
         if not class_name.endswith("Error"):
             class_name += "Error"
         klass = locate("recurly.errors.%s" % class_name)
-        return klass(
-            error.message + ". Recurly Request Id: " + response.request_id, error
-        )
+        msg = error.message + ". Recurly Request Id: " + response.request_id
+        # Use a specific error class if we can find one, else
+        # fall back to a generic ApiError
+        if klass:
+            return klass(msg, error)
+        else:
+            return recurly.ApiError(msg, error)
 
     @classmethod
     def cast_json(cls, properties, class_name=None, response=None):

Error trying to cast error response
**Describe the bug**

Seems there is an error while trying to cast an error response due to a missing error class.

**To Reproduce**

I'm doing a preview request with a wrong zip code (we are using avalara here) and the raw response from the api is the following:

```
{"error":{"type":"service_not_available","message":"Tax service currently not available, please try again later."}}
```

The exception I'm having with the python client is the following:

```
  File ".../lib/python3.8/site-packages/recurly/client.py", line 2718, in preview_purchase
    return self._make_request("POST", path, body, None)
  File ".../lib/python3.8/site-packages/recurly/base_client.py", line 45, in _make_request
    raise Resource.cast_error(resp)
  File .../lib/python3.8/site-packages/recurly/resource.py", line 52, in cast_error
    return klass(
TypeError: 'NoneType' object is not callable
```

Seems code around https://github.com/recurly/recurly-client-python/blob/master/recurly/resource.py#L33 tries to build a class with the name `ServiceNotAvailableError` (matching the returned error type in the json response) but that doesn't exist.

**Expected behavior**

Error response is parsed and a `recurly.ApiError` is raised.

**Your Environment**

- Which version of this library are you using? 3.4.1
- Which version of the language are you using? 3.8

diff --git a/tests/test_resource.py b/tests/test_resource.py
index 9bca2bf..882d4bc 100644
--- a/tests/test_resource.py
+++ b/tests/test_resource.py
@@ -1,6 +1,7 @@
 import unittest
 import recurly
 import platform
+import json
 from datetime import datetime
 from datetime import timezone
 from recurly import Resource, Response, Request
@@ -15,6 +16,10 @@ def cast(obj, class_name=None, resp=None):
     return Resource.cast_json(obj, class_name, resp)
 
 
+def cast_error(obj, resp=None):
+    return Resource.cast_error(obj)
+
+
 class TestResource(unittest.TestCase):
     def test_cast_object_unknown_class(self):
         # should return the original dict
@@ -83,6 +88,29 @@ class TestResource(unittest.TestCase):
         self.assertEqual(type(page.data[0]), MyResource)
         self.assertEqual(page.data[0].my_string, "kmxu3f3qof17")
 
+    def test_cast_unknown_error(self):
+        resp = MagicMock()
+        resp.request_id = "1234"
+        resp.body = json.dumps(
+            {"error": {"type": "unknown", "message": "Error Message"}}
+        ).encode("UTF-8")
+        err = cast_error(resp)
+
+        # When the error class is unknown, it should fallback to ApiError
+        self.assertEqual(type(err), recurly.ApiError)
+        self.assertEqual(str(err), "Error Message. Recurly Request Id: 1234")
+
+    def test_cast_error(self):
+        resp = MagicMock()
+        resp.request_id = "1234"
+        resp.body = json.dumps(
+            {"error": {"type": "validation", "message": "Invalid"}}
+        ).encode("UTF-8")
+        err = cast_error(resp)
+
+        self.assertEqual(type(err), recurly.errors.ValidationError)
+        self.assertEqual(str(err), "Invalid. Recurly Request Id: 1234")
+
     def test_cast(self):
         obj = cast(
             {

pip install -e .
parse_log_pytest
requirements.txt
pytest
3.7
requirements-test.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
Babel==2.14.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
coverage==4.5.3
docutils==0.20.1
exceptiongroup==1.2.2
idna==3.10
imagesize==1.4.1
importlib-metadata==6.7.0
iniconfig==2.0.0
Jinja2==3.1.6
m2r==0.2.1
MarkupSafe==2.1.5
mistune==3.0.2
packaging==24.0
pluggy==1.2.0
pockets==0.9.1
Pygments==2.17.2
pytest==7.4.4
pytz==2025.2
-e git+https://github.com/recurly/recurly-client-python.git@5d3a1faa9792daef003385f4aae57177d48c0358#egg=recurly
requests==2.31.0
six==1.17.0
snowballstemmer==2.2.0
Sphinx==2.0.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-napoleon==0.7
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: recurly-client-python
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - babel==2.14.0
      - charset-normalizer==3.4.1
      - coverage==4.5.3
      - docutils==0.20.1
      - exceptiongroup==1.2.2
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - jinja2==3.1.6
      - m2r==0.2.1
      - markupsafe==2.1.5
      - mistune==3.0.2
      - packaging==24.0
      - pluggy==1.2.0
      - pockets==0.9.1
      - pygments==2.17.2
      - pytest==7.4.4
      - pytz==2025.2
      - requests==2.31.0
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==2.0.1
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-napoleon==0.7
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/recurly-client-python

tests/test_resource.py::TestResource::test_cast_unknown_error
tests/test_resource.py::TestResource::test_cast_from_response tests/test_resource.py::TestResource::test_cast_object_unknown_class
tests/test_resource.py::TestResource::test_cast tests/test_resource.py::TestResource::test_cast_error tests/test_resource.py::TestResource::test_cast_page tests/test_resource.py::TestResource::test_repr_str
recurly/resource.py
recurly/resource.py