Use error names instead of error numbers whenever possible.
Example:
--error ER_BAD_DB_ERROR
USE <not existing database>;
You can find the error names in the include/mysqld_error.h file of a MySQL source distribution, or in the Server Error Message Reference section of the MySQL Reference Manual]. NOTE: Don't do this with error numbers > 2000. Use of the error name does not seem to work well in these cases.