Ask coding questions

← Back to all posts
Repl.it error messages?
h
DynamicSquid

Is there a way that I can get a list of error messages for repl.it? Specifically the Python and C++ errors. For example a C++ error would be this:

I'm asking this since I'm making a project that tries to replicate an error message.

So is there a like a way I could get the different types of errors? Or do I have to just do it manually by putting errors in my code and seeing the result?

Answered by CodeLongAndPros [earned 5 cycles]
View Answer
Voters
ElectroN404
firefish
DynamicSquid
Comments
hotnewtop
CodeLongAndPros

You can look at GCC/Clang source code, for those.

Python has an exception class and a defined format for stack traces.

For SegFaults, just send a SEGV signal.

<edit> Now that this is the answer, let me be clear:

Looking through the GCC code for error messages is not easy!

Thank you.

</edit>
DynamicSquid

@CodeLongAndPros where can I find it?

CodeLongAndPros
DynamicSquid

@CodeLongAndPros oh yeah, don't worry. but the Python thing helped me out a lot

CodeLongAndPros
xxpertHacker

Repl doesn't have it's own error messages, Repl just runs the GCC / CLang compiler, the compiler is what issues errors and warnings. You'll need to look at their documentation for everything they have. (Just a tip, Clang gives better error messages).

Also, very important to note, neither of their error messages are too good, now Rust's error messages, those are great, go look at some Rust errors.

DynamicSquid

@StudentFires oh thanks! and for rust, I might take a look at those, but I'm not familiar with rust that much..

xxpertHacker

@DynamicSquid You don't need to be very familiar, it's kinda close to C++ in many regards, the error messages aren't cryptic though, like C++'s can be.

Coder100

What do you mean getting the different types of errors?
As in a try catch statement?

DynamicSquid

@Coder100 Oh, so I'm making something that prints out a bunch of strings, and those strings look like an error message. Or in other words, I'm trying to replicate them

Coder100

yeah, you are going to have to find them yourself ;)
errors are a platform-specific thing @DynamicSquid