Skip to content

Commit

Permalink
Merge pull request #56 from railwaymen/force_overriding_request_class
Browse files Browse the repository at this point in the history
Inserted assertions in Restler.Request functions for being sure that …
  • Loading branch information
Bartłomiej Świerad committed Sep 11, 2020
2 parents 031bbe2 + a54c576 commit a73040e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Restler/Public/Classes/Request/Request.swift
Expand Up @@ -16,6 +16,7 @@ extension Restler {
///
@available(*, deprecated, message: "Use `subscribe(onSuccess:onFailure:onCompletion:)`")
open func onSuccess(_ handler: @escaping (D) -> Void) -> Self {
assertionFailure("This function have to be overridden")
return self
}

Expand All @@ -30,6 +31,7 @@ extension Restler {
///
@available(*, deprecated, message: "Use `subscribe(onSuccess:onFailure:onCompletion:)`")
open func onFailure(_ handler: @escaping (Swift.Error) -> Void) -> Self {
assertionFailure("This function have to be overridden")
return self
}

Expand All @@ -44,6 +46,7 @@ extension Restler {
///
@available(*, deprecated, message: "Use `subscribe(onSuccess:onFailure:onCompletion:)`")
open func onCompletion(_ handler: @escaping (Result<D, Swift.Error>) -> Void) -> Self {
assertionFailure("This function have to be overridden")
return self
}

Expand All @@ -63,6 +66,7 @@ extension Restler {
@discardableResult
@available(*, deprecated, message: "Use `subscribe(onSuccess:onFailure:onCompletion:)`")
open func start() -> RestlerTaskType? {
assertionFailure("This function have to be overridden")
return nil
}

Expand All @@ -74,6 +78,7 @@ extension Restler {
/// - Returns: `self` for chaining.
///
open func using(session: URLSession) -> Self {
assertionFailure("This function have to be overridden")
return self
}

Expand All @@ -99,6 +104,7 @@ extension Restler {
onFailure: ((_ error: Swift.Error) -> Void)? = nil,
onCompletion: ((_ result: Result<D, Swift.Error>) -> Void)? = nil
) -> RestlerTaskType? {
assertionFailure("This function have to be overridden")
return nil
}
}
Expand Down

0 comments on commit a73040e

Please sign in to comment.