supabase_functions 0.9.3__tar.gz → 0.9.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supabase_functions
3
- Version: 0.9.3
3
+ Version: 0.9.4
4
4
  Summary: Library for Supabase Functions
5
5
  Home-page: https://github.com/supabase/functions-py
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "supabase_functions"
3
- version = "0.9.3" # {x-release-please-version}
3
+ version = "0.9.4" # {x-release-please-version}
4
4
  description = "Library for Supabase Functions"
5
5
  authors = [
6
6
  "Joel Lee <joel@joellee.org>",
@@ -54,9 +54,14 @@ class AsyncFunctionsClient:
54
54
  try:
55
55
  response.raise_for_status()
56
56
  except HTTPError as exc:
57
+ status_code = None
58
+ if hasattr(response, "status_code"):
59
+ status_code = response.status_code
60
+
57
61
  raise FunctionsHttpError(
58
62
  response.json().get("error")
59
- or f"An error occurred while requesting your edge function at {exc.request.url!r}."
63
+ or f"An error occurred while requesting your edge function at {exc.request.url!r}.",
64
+ status_code,
60
65
  ) from exc
61
66
 
62
67
  return response
@@ -54,9 +54,14 @@ class SyncFunctionsClient:
54
54
  try:
55
55
  response.raise_for_status()
56
56
  except HTTPError as exc:
57
+ status_code = None
58
+ if hasattr(response, "status_code"):
59
+ status_code = response.status_code
60
+
57
61
  raise FunctionsHttpError(
58
62
  response.json().get("error")
59
- or f"An error occurred while requesting your edge function at {exc.request.url!r}."
63
+ or f"An error occurred while requesting your edge function at {exc.request.url!r}.",
64
+ status_code,
60
65
  ) from exc
61
66
 
62
67
  return response
@@ -25,20 +25,20 @@ class FunctionsError(Exception):
25
25
 
26
26
 
27
27
  class FunctionsHttpError(FunctionsError):
28
- def __init__(self, message: str) -> None:
28
+ def __init__(self, message: str, code: int | None = None) -> None:
29
29
  super().__init__(
30
30
  message,
31
31
  "FunctionsHttpError",
32
- 400,
32
+ 400 if code is None else code,
33
33
  )
34
34
 
35
35
 
36
36
  class FunctionsRelayError(FunctionsError):
37
37
  """Base exception for relay errors."""
38
38
 
39
- def __init__(self, message: str) -> None:
39
+ def __init__(self, message: str, code: int | None = None) -> None:
40
40
  super().__init__(
41
41
  message,
42
42
  "FunctionsRelayError",
43
- 400,
43
+ 400 if code is None else code,
44
44
  )
@@ -0,0 +1 @@
1
+ __version__ = "0.9.4" # {x-release-please-version}
@@ -1 +0,0 @@
1
- __version__ = "0.9.3" # {x-release-please-version}