What is an “internal error” and how do I fix it?

2020-02-15 09:05发布

问题:

I am using a programming tool (a compiler or IDE or other tool) and it reports an "internal error" with some incomprehensible details when I use it. I want to fix this error. What should I do?

回答1:

The programming tool has to report errors in your program, such as syntax errors in your code, runtime errors when you run it, and test failures when you test it, so you can fix your code. But that programming tool is itself a computer program, and so itself can have bugs in it. Careful programmers of complicated programs include self-checks to detect the consequences of unknown bugs. If one of those self-checks fails, the programmer will have arranged for the program to report information about the failed self-check. To prevent confusion between errors in your code and errors in the tool itself it is conventional to call the error in the tool itself an internal error.

In many programming languages, self-checks are done using assertions, and information about the failure is provided in the form of a stack-trace.

So, how do you fix an internal error? You can't. The error is not in your code. Only the developer of the programming tool can fix it. But that does not mean there is nothing you can do.

  • If you are using an old version of the programming tool, it is possible that a newer version of the tool has fixed the problem. Therefore consider updating or upgrading your programming tool.

  • If your code is making use of unusual or new programming constructs, it may be that the tool has the problem because the constructs are new or unusual, and so have not had the related bugs detected and eliminated by frequent use. Therefore consider rewriting your code not to use any unusual or new programming constructs in the section of your code that seems to have triggered the internal error.

  • If you are using an up to date version of the programming tool, consider submitting a bug report to the developers of the tool.