Skip to content

Commit

Permalink
fix(response): fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Hector Rondon authored and ajsb85 committed Oct 31, 2017
1 parent 3e97446 commit 047d7f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/GlpiRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ public class GlpiRequest {
var errorDict = [String: String]()

if let data = error {
errorObj = try! JSONSerialization.jsonObject(with: data) as? [String] ?? [String]()
do {
errorObj = try JSONSerialization.jsonObject(with: data) as? [String] ?? [String]()
} catch {
errorObj = [String]()
}
}

if errorObj.count == 2 {
Expand Down

0 comments on commit 047d7f8

Please sign in to comment.