Exception: SyntaxError
- Inherits:
-
ScriptError
- Object
- Exception
- ScriptError
- SyntaxError
- Defined in:
- error.c,
error.c
Overview
Raised when encountering Ruby code with an invalid syntax.
eval("1+1=2")
raises the exception:
SyntaxError: (eval):1: syntax error, unexpected '=', expecting $end
Instance Method Summary collapse
-
#new([msg]) ⇒ Object
constructor
Construct a SyntaxError exception.
Methods inherited from Exception
#==, #backtrace, #backtrace_locations, #cause, #exception, exception, #full_message, #inspect, #message, #set_backtrace, #to_s, to_tty?
Constructor Details
#new([msg]) ⇒ Object
Construct a SyntaxError exception.
2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 |
# File 'error.c', line 2135
static VALUE
syntax_error_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE mesg;
if (argc == 0) {
mesg = rb_fstring_lit("compile error");
argc = 1;
argv = &mesg;
}
return rb_call_super(argc, argv);
}
|