adding error handling

Adding error handling to serialize & the ability to set a code on the result object.

To pass output data, set:

```javascript
res.data = yourData;
```

To set a response code:

```javascript
res.code = 400;
```

To pass an error message:
```javascript
res.data = {
  errors : [
    { message : "Your message" , status : "Unauthorized" }
  ]
};
```