whole_func_string: function formatError(error: mixed): Error {
      if (typeof error === 'object' && error != null && error instanceof Error) {
          return error;
      }
      if (typeof error === 'object' && error != null && error.message != null) {
          return new Error(error.message);
      }
      return new Error(JSON.stringify(error));
  }
func_code_string: function formatError(error: mixed): Error {
      if (typeof error === 'object' && error != null && error instanceof Error) {
          return error;
      }
      if (typeof error === 'object' && error != null && error.message != null) {
          return new Error(error.message);
      }
      return new Error(JSON.stringify(error));
  }
func_documentation_string: making sure that Error from a promise is an Error object