Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX-ATTEMPT: Try to use a class instead of mutating struct for JSONAPIError.Builder #126

Merged
merged 1 commit into from
Sep 26, 2016
Merged
Changes from all commits
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
8 changes: 4 additions & 4 deletions Source/JSONAPIError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct JSONAPIError: ResponseFieldsProvider {
}

/// A builder for JSONAPIError
public struct Builder: Serializable {
public class Builder: Serializable {

/// A unique identifier for this particular occurrence of the problem.
public var id: String?
Expand Down Expand Up @@ -96,9 +96,9 @@ public struct JSONAPIError: ResponseFieldsProvider {

- returns: An error that conforms to JSON API specifications and it's ready to be serialized
*/
public init(statusCode: Int, headerFields: [String: String]? = nil, errorBuilder: (error: inout Builder) -> ()) {
var builder = Builder(statusCode: statusCode)
errorBuilder(error: &builder)
public init(statusCode: Int, headerFields: [String: String]? = nil, errorBuilder: (error: Builder) -> ()) {
let builder = Builder(statusCode: statusCode)
errorBuilder(error: builder)
self.builder = builder
self.headerFields = headerFields
}
Expand Down