Better error codes

This trick doesn't seems to work ... @merlinND  ?