File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- # [START error_reporting]
16- from google .cloud import error_reporting
17-
1815
16+ # [START error_reporting]
1917def simulate_error ():
18+ from google .cloud import error_reporting
19+
2020 client = error_reporting .Client ()
2121 try :
2222 # simulate calling a method that's not defined
@@ -26,5 +26,15 @@ def simulate_error():
2626# [END error_reporting]
2727
2828
29+ # [START error_reporting_manual]
30+ def report_manual_error ():
31+ from google .cloud import error_reporting
32+
33+ client = error_reporting .Client ()
34+ client .report ("An error has occurred." )
35+ # [END error_reporting_manual]
36+
37+
2938if __name__ == '__main__' :
3039 simulate_error ()
40+ report_manual_error ()
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- import pytest
16-
1715import report_exception
1816
1917
20- @pytest .mark .xfail (
21- strict = True ,
22- reason = 'GoogleCloudPlatform/google-cloud-python#3263' )
2318def test_error_sends ():
2419 report_exception .simulate_error ()
20+
21+
22+ def test_manual_error_sends ():
23+ report_exception .report_manual_error ()
You can’t perform that action at this time.
0 commit comments