Skip to content

Commit

Permalink
FIX-ATTEMPT: Try to use a class instead of mutating struct for JSONAP…
Browse files Browse the repository at this point in the history
…IError.Builder (#79) (#126)

theory some bug while mutating the struct prevent it to work correctly? I don't think it's a Router issue because only happens with this test
  • Loading branch information
MP0w authored Sep 26, 2016
1 parent 7450b8f commit f48cb36
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit f48cb36

Please sign in to comment.