title: Javascript console logging extended exceptions
body: <p>There are libraries that throw extended errors, for example GraphQl Apollo gives one. Trying to log it straight into console gives only the general title like "Server Error" hiding the details.</p>
  
  <p>Is there a way to print error objects into console like other objects, allowing you to browse through it? Following code is a reproduction in code of the problem.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class RError extends Error {
      constructor({name, message, cause}) {
          super();
          this.name = name;
          this.message = message;
          this.cause = cause;
      }
  }
  
  function fail() {
      throw new RError({
          name: 'BAR',
          message: 'I messed up.'
      });
  }
  
  function failFurther() {
      try {
          fail();
      } catch (err) {
          throw new RError({
              name: 'FOO',
              message: 'Something went wrong.',
              cause: err
          });
      }
  }
  
  try {
      failFurther();
  } catch (err) {
      // Prints "FOO: Something went wrong" and stacktrace, hiding the cause
      console.error(err);
      // It's still available if you know the path
      console.error(err.cause);
  }</code></pre>
  </div>
  </div>
  </p>