来自外部订阅的错误函数处理内的订阅

时间:2020-03-26 14:24:26

标签: angular rxjs

我在另一个订阅中有一个订阅案例,我们知道这很糟糕。问题是我不知道如何在这里解决它:

j == a

我尝试过这样的事情:

Protocols h2 http/1.1

<VirtualHost 127.0.0.1:443>
  DocumentRoot /var/www/html
  ServerName 127.0.0.1:443
  ErrorLog /var/log/apache2/ssl_myproject_error.log
  TransferLog /var/log/apache2/ssl_myproject_access.log

  SSLEngine on
  SSLCertificateFile /etc/ssl/fullchain.pem
  SSLCertificateKeyFile /etc/ssl/privkey.pem
  SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
  Protocols h2 http/1.1

  <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
    SetHandler "proxy:fcgi://myproject_dev_php:9000"
  </FilesMatch>

  <FilesMatch ".+\.phps$">
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
  </FilesMatch>

  <FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
  </FilesMatch>

  <Directory /var/www/html>
    SSLOptions +StdEnvVars
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>

这可行,但是感觉不对,我不想转换/更改流,它应该结束。

1 个答案:

答案 0 :(得分:2)

只需重新排序即可,如果发生错误,它将跳至catchError() 如果没有错误,它将运行switchMap

this.backendService.doSomething().pipe(
  switchMap(()=> someService.showOkMessage('title', 'everything is fine')),
  catchError(errMsg => 
    someService.showOkMessage('title', 'you got an error')
  ),
).subscribe();
相关问题