File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change 55import asyncio
66import configparser
77from graph import Graph
8+ from msgraph .generated .models .o_data_errors .o_data_error import ODataError
89
910async def main ():
1011 print ('Python Graph Tutorial\n ' )
@@ -33,18 +34,23 @@ async def main():
3334 except ValueError :
3435 choice = - 1
3536
36- if choice == 0 :
37- print ('Goodbye...' )
38- elif choice == 1 :
39- await display_access_token (graph )
40- elif choice == 2 :
41- await list_inbox (graph )
42- elif choice == 3 :
43- await send_mail (graph )
44- elif choice == 4 :
45- await make_graph_call (graph )
46- else :
47- print ('Invalid choice!\n ' )
37+ try :
38+ if choice == 0 :
39+ print ('Goodbye...' )
40+ elif choice == 1 :
41+ await display_access_token (graph )
42+ elif choice == 2 :
43+ await list_inbox (graph )
44+ elif choice == 3 :
45+ await send_mail (graph )
46+ elif choice == 4 :
47+ await make_graph_call (graph )
48+ else :
49+ print ('Invalid choice!\n ' )
50+ except ODataError as e :
51+ print ('Error:' )
52+ if e .error is not None :
53+ print (e .error .code , e .error .message )
4854# </ProgramSnippet>
4955
5056# <GreetUserSnippet>
You can’t perform that action at this time.
0 commit comments