Allow objects to be returned on error instead of string

With version 9 it was implied that objects could be returned from the config/errors.js functions, which works in theory, but the API still returns {"error": "Error: [object object]"} instead of {"error": {some: "object"}}

This update allows returned objects in config/errors.js to actually replace the error string with an object and includes a new test file for errors.