Method for detecting errors both in production and debug mode (also basic and component errors)