fix: change types of parameters for js errors
This commit is contained in:
parent
c75ff4c1d0
commit
3e7307424a
|
|
@ -25,15 +25,20 @@ import Foundation
|
|||
public struct WebViewJSError: WebViewError, Codable {
|
||||
public let contentURL: URL?
|
||||
public let name: String?
|
||||
public let message: String?
|
||||
public let message: Int?
|
||||
public let stackTrace: String?
|
||||
|
||||
public init(contentURL: URL?,
|
||||
public init(stringURL: String?,
|
||||
name: String?,
|
||||
message: String?,
|
||||
message: Int?,
|
||||
stackTrace: String?) {
|
||||
|
||||
self.contentURL = contentURL
|
||||
if let stringURL = stringURL {
|
||||
self.contentURL = URL(string: stringURL)
|
||||
} else {
|
||||
self.contentURL = nil
|
||||
}
|
||||
|
||||
self.name = name
|
||||
self.message = message
|
||||
self.stackTrace = stackTrace
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ open class DefaultWebViewModel: NSObject, WebViewModel {
|
|||
|
||||
private func parseError(_ message: WKScriptMessage) -> WebViewError {
|
||||
let body = message.body as? [String: Any]
|
||||
return WebViewJSError(contentURL: body?[WebViewErrorConstants.errorUrl] as? URL,
|
||||
return WebViewJSError(stringURL: body?[WebViewErrorConstants.errorUrl] as? String,
|
||||
name: body?[WebViewErrorConstants.errorName] as? String,
|
||||
message: body?[WebViewErrorConstants.errorMessage] as? String,
|
||||
message: body?[WebViewErrorConstants.errorMessage] as? Int,
|
||||
stackTrace: body?[WebViewErrorConstants.errorStack] as? String)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue