How to handle error and return observable while subscribe inside an observable function in Rxjs Angular

I want to check one api call inside an observable which I will subscribe in a component. As written below, I want to run my observable in this manner but it is not working. What changes shall I do to this code to make it work. Whenever I try to subscribe through it especially through the scenario when someObservableWrittenInTheSameService returns with an error 404, I want to return url2.

getfunction(submissionId: string ){

if (some condition) {
   this.someObservableWrittenInTheSameService(parameter).subscribe(
    (httpValue: any) => {
      let url = '';
      if (httpValue.code === 200) {
         return this.http.get(url1); 
      }
    }, err => {
      if (err.code === 404) {
        return this.http.get(url2);
      }
      
    }
  )
}

  let url3
  return this.http.get(url3);
}

This function is then is called in a component where it is subscribed. But whenever someObservableWrittenInTheSameService return 404, the subscription always fails and go to error block in the component.