@@ -18,7 +18,7 @@ def _internal_exceptions():
1818 except Exception :
1919 hub = Hub .current
2020 if hub :
21- hub .capture_internal_exception (sys .exc_info ())
21+ hub ._capture_internal_exception (sys .exc_info ())
2222
2323
2424def _get_client_options ():
@@ -124,7 +124,13 @@ def bind_client(self, new):
124124 self ._stack [- 1 ] = (new , top [1 ])
125125
126126 def capture_event (self , event , hint = None ):
127- """Captures an event."""
127+ """Captures an event. The return value is the ID of the event.
128+
129+ The event is a dictionary following the Sentry v7/v8 protocol
130+ specification. Optionally an `EventHint` object can be passed that
131+ is used by processors to extract additional information from it.
132+ Typically the event hint object would contain exception information.
133+ """
128134 client , scope = self ._stack [- 1 ]
129135 if client is not None :
130136 rv = client .capture_event (event , hint , scope )
@@ -133,15 +139,22 @@ def capture_event(self, event, hint=None):
133139 return rv
134140
135141 def capture_message (self , message , level = None ):
136- """Captures a message."""
142+ """Captures a message. The message is just a string. If no level
143+ is provided the default level is `info`.
144+ """
137145 if self .client is None :
138146 return
139147 if level is None :
140148 level = "info"
141149 return self .capture_event ({"message" : message , "level" : level })
142150
143151 def capture_exception (self , error = None ):
144- """Captures an exception."""
152+ """Captures an exception.
153+
154+ The argument passed can be `None` in which case the last exception
155+ will be reported, otherwise an exception object or an `exc_info`
156+ tuple.
157+ """
145158 client = self .client
146159 if client is None :
147160 return
@@ -156,15 +169,19 @@ def capture_exception(self, error=None):
156169 try :
157170 return self .capture_event (event , hint = hint )
158171 except Exception :
159- self .capture_internal_exception (sys .exc_info ())
172+ self ._capture_internal_exception (sys .exc_info ())
160173
161- def capture_internal_exception (self , exc_info ):
174+ def _capture_internal_exception (self , exc_info ):
162175 """Capture an exception that is likely caused by a bug in the SDK
163176 itself."""
164177 logger .debug ("Internal error in sentry_sdk" , exc_info = exc_info )
165178
166179 def add_breadcrumb (self , crumb = None , hint = None , ** kwargs ):
167- """Adds a breadcrumb."""
180+ """Adds a breadcrumb. The breadcrumbs are a dictionary with the
181+ data as the sentry v7/v8 protocol expects. `hint` is an optional
182+ value that can be used by `before_breadcrumb` to customize the
183+ breadcrumbs that are emitted.
184+ """
168185 client , scope = self ._stack [- 1 ]
169186 if client is None :
170187 logger .info ("Dropped breadcrumb because no client bound" )
0 commit comments