如果ruby on rails脚本中有多个错误,它如何知道哪一个显示?

时间:2022-01-14 12:29:56

I often write some code, then get an error, change it, and see a different error. Does this mean that the first error is fixed and that I only have a new error because of what I just changed? or just that this new error is more "pressing" than the first? How can I find out?

我经常写一些代码,然后得到一个错误,改变它,看到一个不同的错误。这是否意味着第一个错误是固定的,而我只是因为刚刚更改的内容而出现了新的错误?或者只是说这个新错误比第一个错误更“紧迫”?我该怎么知道?

1 个解决方案

#1


1  

It could be both. Most times when you fix the first error you should just be seeing a notice for the error that follows. However, if your fix was not correct or was messing with previous snippets, you could be causing errors out of the blue.

它可能都是。大多数情况下,当您修复第一个错误时,您应该只看到后面的错误通知。但是,如果您的修复程序不正确或者正在弄乱先前的代码段,则可能会导致错误。

That is why techniques like testing are important. If such logic errors occur, your test suite is there to save the day.

这就是测试等技术很重要的原因。如果出现这样的逻辑错误,那么您的测试套件可以节省一天的时间。

#1


1  

It could be both. Most times when you fix the first error you should just be seeing a notice for the error that follows. However, if your fix was not correct or was messing with previous snippets, you could be causing errors out of the blue.

它可能都是。大多数情况下,当您修复第一个错误时,您应该只看到后面的错误通知。但是,如果您的修复程序不正确或者正在弄乱先前的代码段,则可能会导致错误。

That is why techniques like testing are important. If such logic errors occur, your test suite is there to save the day.

这就是测试等技术很重要的原因。如果出现这样的逻辑错误,那么您的测试套件可以节省一天的时间。