 	key: 'unknown'
 	template: BaseError.template
 		
-	toJSON: ->
-		key: @key
-		message: @message
+	toJSON: -> [@key, @message]
 		
 exports.errorTypes = ->
 	

	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) ->
