Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs(python): add error codes to the reference docs (#29162)

Andrew Smith6bdb4f537e1e
diff --git a/apps/docs/docs/ref/python/auth-error-codes.mdx b/apps/docs/docs/ref/python/auth-error-codes.mdx
new file mode 100644
index 00000000000..47e1c63bda9
--- /dev/null
+++ b/apps/docs/docs/ref/python/auth-error-codes.mdx
@@ -0,0 +1,12 @@
+Supabase Auth can throw or return various errors when using the API. All errors originating from the `supabase.auth` namespace of the client library will be wrapped by the `AuthError` class.
+
+Error objects are split in a few classes. `AuthApiError` is an error which originate from the Supabase Auth API.
+
+Errors originating from the server API classed as `AuthApiError` always have a `code` property that can be used to identify the error returned by the server. The `status` property is also present, encoding the HTTP status code received in the response.
+
+<AuthErrorCodesTable />
+
+### Tips for better error handling
+
+- Do not use string matching on error messages! Always use the `name` and `code` properties of error objects to identify the situation.
+- Although HTTP status codes generally don't change, they can suddenly change due to bugs, so avoid relying on them unless absolutely necessary.
diff --git a/apps/docs/spec/common-client-libs-sections.json b/apps/docs/spec/common-client-libs-sections.json
index 3a1bd0cd937..a1f249de8ac 100644
--- a/apps/docs/spec/common-client-libs-sections.json
+++ b/apps/docs/spec/common-client-libs-sections.json
@@ -407,7 +407,6 @@
"reference_dart_v1",
"reference_javascript_v1",
"reference_kotlin_v1",
- "reference_python_v2",
"reference_swift_v1",
"reference_swift_v2"
]