Skip to content

Commit 229a277

Browse files
committed
Add a couple error messages
1 parent 526d741 commit 229a277

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

swift/example_code/ec2/scenario/Sources/entry.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ class Example {
427427
return nil
428428
}
429429

430+
// Build the URL of the temporary private key file.
431+
430432
let fileURL = URL.temporaryDirectory
431433
.appendingPathComponent(name)
432434
.appendingPathExtension("pem")
@@ -435,9 +437,11 @@ class Example {
435437
try keyMaterial.write(to: fileURL, atomically: true, encoding: String.Encoding.utf8)
436438
return fileURL
437439
} catch {
440+
print("*** Failed to write the private key.")
438441
return nil
439442
}
440443
} catch {
444+
print("*** Unable to create the key pair.")
441445
return nil
442446
}
443447
}
@@ -894,7 +898,7 @@ class Example {
894898
print("Getting the IP address...")
895899
return try String(contentsOf: url, encoding: String.Encoding.utf8).trim()
896900
} catch {
897-
print("Got an error!")
901+
print("*** Unable to get your public IP address.")
898902
return nil
899903
}
900904
}

0 commit comments

Comments
 (0)