You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core_concepts.rst
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,51 @@ Please see the :doc:`pydantic` page for more information about valid types.
35
35
36
36
Arguments to the ``@intersect_message()`` decorator can be used to specify specific details about your function; for example, the Content-Types of both the request and response parameter, the data provider for the response data, and whether you want to allow type coercion in the request.
37
37
38
+
Exception Handling
39
+
^^^^^^^^^^^^^^^^^^
40
+
41
+
By default, if a Capability raises an Exception, unhandled or otherwise, it will be logged server-side but the information will NOT be sent to the Client. To send a more detailed message to the Client, catch error messages yourself and raise ``IntersectCapabilityError`` with your error string as the argument:
42
+
43
+
Note that you should be very careful about what Exception information you include when you raise ``IntersectCapabilityError``.
44
+
45
+
Here is an example
46
+
47
+
.. code-block:: python
48
+
49
+
from pydantic import BaseModel
50
+
from intersect_sdk import IntersectBaseCapabilityImplementation, IntersectCapabilityError
except (FileNotFoundError, ValueError) as e: # only raising specific kinds of exceptions, let other exceptions propagate (they will be caught by the INTERSECT-SDK)
77
+
ifself.debug:
78
+
# propagate the exception message to the client
79
+
raise IntersectCapabilityError(f'An error occurred in my_message: {str(e)}')
80
+
# do NOT propagate the exception message to the client
0 commit comments