我正在尝试在可视代码中调试角度/打字稿应用程序。假设我运行以下代码
try {
...
} catch (error) {
console.log(error);
}
Run Code Online (Sandbox Code Playgroud)
假设发生错误,我将在控制台中看到正常执行时记录的错误。我面临的问题是,如果我在调试模式下运行相同的情况(“针对本地主机启动 Chrome”)。我会得到:
“未捕获的引用错误:错误未定义”
如果我在调试视图中查看“Closure”部分而不是“Local”部分。我可以访问error_其中确实包含正常执行中通常记录的内容。
有没有办法在角度/打字稿应用程序中查看错误而error不是在调试模式下?error_1
我尝试了 Typescript/babel import 的建议,导致“ _1.default is not a function ”,但没有成功。
考虑以下代码:
public Mono<Void> doStuff() {
return this.requestStuff()
.onStatus(HttpStatus::is5xxServerError,
clientResponse -> {
aMethodIWouldLikeToTest(clientResponse);
return Mono.error(new MyCustomException("First error I would like to test"));
})
.onStatus(HttpStatus::is4xxClientError,
clientResponse -> {
aMethodIWouldLikeToTest(clientResponse);
return Mono.error(new MyCustomException("Second error I would like to test"));
})
.bodyToMono(String.class)
.flatMap(x -> anotherMethodIManagedToTest(x)))
}
Run Code Online (Sandbox Code Playgroud)
我的第一个目标是测试anotherMethodIManagedToTest(x),这是使用以下方法实现的:
import org.springframework.web.reactive.function.client.WebClient;
...
@Mock
private WebClient.ResponseSpec responseSpec;
private String desiredInputParam = "There is another black spot on the sun today!";
...
@Test
public void allGood_anotherMethodIManagedToTest_success {
...
ClassUnderTest classUnderTest = new classUnderTest()
ClassUnderTest classUnderTestSpy = …Run Code Online (Sandbox Code Playgroud)