Improved error message for failing with wrong error

parent 94d05ebc
...@@ -3549,11 +3549,12 @@ static void handle_error(const char *query, struct st_query *q, ...@@ -3549,11 +3549,12 @@ static void handle_error(const char *query, struct st_query *q,
if (i) if (i)
{ {
if (q->expected_errno[0].type == ERR_ERRNO) if (q->expected_errno[0].type == ERR_ERRNO)
die("query '%s' failed with wrong errno %d instead of %d...", die("query '%s' failed with wrong errno %d: '%s', instead of %d...",
q->query, err_errno, q->expected_errno[0].code.errnum); q->query, err_errno, err_error, q->expected_errno[0].code.errnum);
else else
die("query '%s' failed with wrong sqlstate %s instead of %s...", die("query '%s' failed with wrong sqlstate %s: '%s', instead of %s...",
q->query, err_sqlstate, q->expected_errno[0].code.sqlstate); q->query, err_sqlstate, err_error,
q->expected_errno[0].code.sqlstate);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -16,7 +16,7 @@ otto ...@@ -16,7 +16,7 @@ otto
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22... mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
select friedrich from (select 1 as otto) as t1; select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list' ERROR 42S22: Unknown column 'friedrich' in 'field list'
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000... mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'field list'', instead of 00000...
select otto from (select 1 as otto) as t1; select otto from (select 1 as otto) as t1;
otto otto
1 1
...@@ -133,7 +133,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist ...@@ -133,7 +133,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
select 1146 as "after_!errno_masked_error" ; select 1146 as "after_!errno_masked_error" ;
after_!errno_masked_error after_!errno_masked_error
1146 1146
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000... mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
select 1064 as "after_--enable_abort_on_error" ; select 1064 as "after_--enable_abort_on_error" ;
...@@ -141,7 +141,7 @@ after_--enable_abort_on_error ...@@ -141,7 +141,7 @@ after_--enable_abort_on_error
1064 1064
select 3 from t1 ; select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1064... mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064...
hello hello
hello hello
;;;;;;;; ;;;;;;;;
...@@ -374,7 +374,7 @@ mysqltest: At line 1: Missing connection user ...@@ -374,7 +374,7 @@ mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection user mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection password mysqltest: At line 1: Missing connection password
mysqltest: At line 1: Missing connection db mysqltest: At line 1: Missing connection db
mysqltest: At line 1: Could not open connection 'con2': Unknown database 'illegal_db' mysqltest: At line 1: Could not open connection 'con2': 1049 Unknown database 'illegal_db'
mysqltest: At line 1: Illegal argument for port: 'illegal_port' mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP mysqltest: At line 1: Illegal option to connect: SMTP
OK OK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment