Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added an alert as to go along with the print statement so that the us…
…er will at least know there was an error.
  • Loading branch information
watkyn committed Sep 15, 2020
commit f6ed3c2b3d1fdd2340de9ab8ed422deb29fe0f06
7 changes: 5 additions & 2 deletions Source/JamfProClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ struct JamfProClient {
sendRequest(endpoint: "osxconfigurationprofiles", data: xml.xmlData) { (statusCode, resultData) in
let success: Bool = (200 <= statusCode && statusCode <= 299)
if !success {
var errMessage = ""
if let text = String(data: resultData, encoding: .utf8) {
print("Error (\(statusCode)):\n\(text)")
errMessage = "Error (\(statusCode)):\n\(text)"
} else {
print("Unknown error: \(statusCode)")
errMessage = "Unknown error: \(statusCode)"
}
print(errMessage)
Alert().display(header: "Upload failed", message: errMessage)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Alert().display(header: "Upload failed", message: errMessage)
Alert().display(header: "Upload failed:", message: errMessage)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want a colon at the end of the header. The header describes the situation on one line, and then the message gives more detail, and the message already has a colon, so it would look strange to have two colons.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw that there is a colon in other messages for example "Attention:".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah dang, I didn't notice it there.

}
completionBlock(success)
}
Expand Down