Depends on how you are getting it. If it comes out that nicely, I have to admit I'm a bit surprised by it. Errors are typically far more ambiguous.
Use the mysql_errno() (or the library equivalent). If you are using mysql you can get the error codes here: http://dev.mysql.com/doc/refman/5.1/...es-server.html
. Looks like errno of 1022 in MySQL dictates that its a duplicate key, so if you check the errno on there you should see 1022. Use it to your advantage when determining what to show.