File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " sam-patterns-cli" ,
3- "version" : " 0.0.42 " ,
3+ "version" : " 0.0.43 " ,
44 "description" : " Command line interface for quickly using patterns from https://github.com/aws-samples/serverless-patterns/" ,
55 "main" : " index.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -52,7 +52,12 @@ async function run(cmd) {
5252 }
5353 }
5454 path += "/" + cmd . template ;
55+ try {
5556 template = await githubUtil . getContent ( owner , repo , path ) ;
57+ } catch ( e ) {
58+ console . log ( "Couldn't find " + cmd . template + " in " + cmd . repositoryPath ) ;
59+ return ;
60+ }
5661 }
5762 const configuration = new Configuration ( {
5863 apiKey,
@@ -87,10 +92,16 @@ async function run(cmd) {
8792 max_tokens : 1000
8893 } ;
8994 spinner . start ( ) ;
95+ try {
96+
9097 const response = await openai . createChatCompletion ( openAiRequest ) ;
9198 spinner . stop ( ) ;
9299 let text = response . data . choices [ 0 ] . message . content ;
93100 console . log ( `\n\n${ text } ` ) ;
101+ } catch ( error ) {
102+ spinner . stop ( ) ;
103+ console . log ( "\n\n" + error . response . data . error . message ) ;
104+ }
94105
95106
96107}
You can’t perform that action at this time.
0 commit comments