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.
1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 |
# File 'error.c', line 1969
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);
}
|