Currenty, lasterror cpntains the last error message in the currently chosen GUI language. If you want to test programatically for a certain error, then you have to account for the dependence on the language setting. This can be done using description strings for dummy variables, where you can specify the reference strings in whatever language you want.
To support all languages would require to find out the error string for all the languages and then to add them to the description. This is not really handy.
Proposal: provide a function lasterror(lang) where lang is a string specifying the language (as in the SMath xml files).