title: Custom Error Object with Apollo Server
body: <p>I'm trying to use a custom error with <a href="https://github.com/apollostack/apollo-server" rel="noreferrer">apollo-server</a> and it seems that my custom error has a property (<code>code</code>) that isn't available from within <code>formatError</code>.</p>
  
  <pre><code>import ExtendableError from 'es6-error'
  
  export default class MyError extends ExtendableError {
    constructor(args) {
      let code = Object.keys(args)[0]
      let message = Object.values(args)[0]
      super(message)
      this.code = code
    }
  }
  </code></pre>
  
  <p>I have a simple error handler works something like this:</p>
  
  <pre><code>let INVALIDREQUEST = 'invalid request'
  let e = new MyError({INVALIDREQUEST})
  console.log(e.code) // =&gt; "INVALIDREQUEST"
  </code></pre>
  
  <p>I'm having trouble because when I log <code>error.code</code> from within <code>formatError</code> it's not available.</p>
  
  <pre><code>formatError: function (error) {
    console.log(error.code) // =&gt; undefined
    return error
  }
  </code></pre>
  
  <p>How can I propagate custom properties (like <code>code</code>) of <code>error</code> from within <code>formatError</code>?</p>