 	if error instanceof BaseError
 		error
 	else if error instanceof Error
-		message: error.message
+		[null, error.message]
 	else
-		message: error
+		[null, error]
 	
-exports.unserialize = (data) -> exports.instantiate data.key, data.message
+exports.unserialize = (data) -> exports.instantiate.apply null, data
 	
 exports.message = (error) ->
 

	output = output.replace ":#{key}", value for key, value of error
	output
	
exports.instantiate = (key, message) ->
	
	Types = exports.errorTypes()
	Type = if Types[key]? then Types[key] else BaseError

	new Type message
	
exports.caught = (error) ->
	return error unless error instanceof BaseError

	pkgman.invoke 'errorType', (path, spec) -> collected.push spec
		
	types = {}
	types[Type::key] = Type for Type in collected
	types

exports.serialize = (error) ->
