     public init(_ any: Any) {
         wrapped = any
     }
+    
+    internal init(error: ErrorType) {
+        self.wrapped = ()
+        self.error = error
+    }
 }
 
 // Private helpers
 extension JSONValue {
     private func asArray() throws -> [JSONValue] {
+        try throwIfError()
         guard let objectArray = self.wrapped as? [AnyObject] else {
             throw JSONError(.IncompatibleType(typename: "array"), json: self)
         }


public struct JSONValue {
    internal var wrapped: Any
    
    /// Initialize a `JSONValue` by parsing the given `NSData`
    public init(parse data: NSData) throws {

    }
    
    private func asDictionary() throws -> [String:JSONValue] {
        try throwIfError()
        guard let objectDictionary = self.wrapped as? [String:AnyObject] else {
            throw JSONError(.IncompatibleType(typename: "dictionary"), json: self)
        }
        return objectDictionary.transform({ JSONValue($0) })
    }
    
    private func throwIfError() throws {
        if let error = self.error {
            throw error
        }
    }
}

