title: How does HTTP error-handling work with observables?
body: <p>I see a lot of tutorials doing something like this:</p>
  
  <pre><code>http.get("...").subscribe(
    success =&gt; console.log('hello success'),
    error =&gt; console.log('bye error')
  );
  </code></pre>
  
  <p>I don't know how this works, since there aren't any types or anything, <strong>however</strong> I tried to do that myself and I end up that the request always goes into success, even if I have an error. What is the problem?</p>
  
  <p><strong>Troublemaker:</strong></p>
  
  <pre><code>this.memberService.create(this.currentMember)
        .subscribe(
          success =&gt; {
            let mem: Member = success.json() as Member;
            if (this.selectedOrganization) {
              this.addMemberToOrganization(mem);
            } else if (this.selectedServiceProvider) {
              this.addMemberToServiceProvider(mem);
            } else {
              this.toastsService.error("lbl_users_service_provider_and_organization_undefined");
            }
          },
          error =&gt; console.log(error)
        );
  </code></pre>
  
  <p><strong>Create-Method in the memberService:</strong></p>
  
  <pre><code>  create(member: Member): Observable&lt;any&gt; {
      return this.http
        .post(this.RESOURCE_BASE_URL, member)
        .map(response =&gt; {
          if (response.status === 200) this.toastsSerivce.success(this.translateService.instant('lbl_users_member_created'));
          return response;
        })
        .catch(error =&gt; this.toastsSerivce.error(this.translateService.instant('lbl_users_member_create_failed')));
    }
  </code></pre>
  
  <p>I even catch the error, but the <code>subscribe</code> part doesn't seem to care.
  It fails at <code>success.json()</code>, because if there is an error, there is no <code>json</code>. But if there is an error, I want it to call the <code>error =&gt;...</code> instead of the <code>success</code>. Any advice is highly appreciated.</p>