import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
+import reactor.core.publisher.Mono;
/**
@GetMapping("/")
public String fetch(Model model, @RequestParam String path)
{
- model.addAttribute("text", service.getRemoteText(path));
+ model.addAttribute(
+ "text",
+ service
+ .getRemoteText(path)
+ .onErrorResume(t -> Mono.just(t.getMessage())));
return "home";
}
}